Page 1 of 1

dbContext template and collections

Posted: Tue 23 Oct 2018 17:35
by chneumann
HI,
I have a need to have collections created as Lists as opposed to HashSets or ObservableCollections which seem to be the only two options. Based on other forum entries and the documentation, this is possible with the NHibernate template, but I do not see the same capability for the dbConext templates.

Is there a way to accomplish this?

Thanks,
Carl

Re: dbContext template and collections

Posted: Fri 26 Oct 2018 18:56
by Shalex
We are processing your request. We will contact you as soon as possible.

Re: dbContext template and collections

Posted: Mon 29 Oct 2018 14:27
by figueiredorj
@chneumann,
by default dbcontext generates ICollection<>;
List is an implementation of it so you can safely cast to List<>.

Re: dbContext template and collections

Posted: Thu 08 Nov 2018 14:33
by Shalex
@figueiredorj,
Thank you for posting. Your answer is about EF Core.

@chneumann,
You are working with EF6, aren't you? The type ICollection<T> or ObservableCollection or ObservableListSource of collection property depends on the values of the following DbContext template properties: EnableWinFormsDataBinding, UseObservableCollection, ProxyCreationEnabled. Does this information help?