English 中文(简体)
实体框架:显示一组数据的替代收集
原标题:Entity Framework: a proxy collection for displaying a subset of data

Imagine I拥有一个称为产品的实体和一个产品存放处:

public class Product
{
    public int Id { get; set; }
    public bool IsHidden { get; set; }
}

public class ProductRepository
{
    public ObservableCollection<Product> AllProducts { get; set; }
    public ObservableCollection<Product> HiddenProducts { get; set; }
}

所有产品都包含数据库中的每一种产品,而黑色产品必须只包含那些产品,其IsHidden =真正的。 我写了<代码>的类型。 ObservableCollection<Product>, 但不必如此。

目标是有<编码> 编码收集,作为产品特性改变的代用条目AllProducts

是否有这样做的正常办法? 或者,我的逻辑可能是错误的,可以做得更好?

最佳回答

Ended on CollectionView/.CollectionViewSource.

问题回答

暂无回答




相关问题
Is HashMap in Java collision safe

I am developing a parser that needs to put key value pairs in hashmap. A key can have multiple values which I can do in this way HashMap<String,ArrayList<String>> . What happens if the ...

iterating over map and array simultaneously in a for loop

I am having some trouble creating a for loop within a constructor to iterate over a map and an array at the same time. Here, it is indicated that this cannot be done with an enhanced for loop. I have ...

PLSQL Collections - how to use table of records?

I m new to PL/SQL and I m trying to use a table of records, but I don t know how to use this feature. What is the problem? DECLARE TYPE TIP IS RECORD ( F1 ...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

Concurrent modification whilst traversing a ruby Hash

Suppose you had this: def wipeProduct(hash, nameToDelete) hash.each do |i| key = i[0] productName = i[1].first hash.delete(key) if productName==nameToDelete end end I m not sure it ...

热门标签