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?

Re: dbContext template and collections

Posted: Sat 20 Jun 2020 19:57
by Shalex
Entity Developer 6.8 is released: viewtopic.php?f=32&t=41293.

It includes the following improvements:
* The new property Collection Property Type is added to EF template "DbContext" and EF Core template "EF Core" to determine .NET type used as a property type for the Many end of associations
* The new property Collection Initialization Type is added to EF template "DbContext" and EF Core template "EF Core" to determine .NET type used for initialization of the Many end of association; if it is set to None, then no initialization is generated