Question

Getting this:

System.Collections.Generic.HashSet`1[Counter]

Expecting this:

ICollection<Counter>

//underlying Object:

public virtual ICollection<Counter> Counters { get; private set; }

I'm using DevExpress PropertyGridControl:

dxprg:CollectionDefinition Path="Counters" Type="{x:Type efo:Counter}"

I take it this normal behavior for EF considering I'm not calling any function on the Collection of counters like, for example, ToList() but because of the Path property on the CollectionDefenition it's not clear how to do so. I could create a real-time object, populate it with equal values, init the Collection and then Bind to it but that seems really dirty.

Any wisdom on what is happening here with regard to EF is welcome..

Was it helpful?

Solution

Entity Framework needs something to implement the ICollection It uses HashSet<T> because that is a rather efficient ICollection<T> implementation. In the end, every object implementing an interface is always some concrete class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top