문제

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..

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top