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
dbContext template and collections
Re: dbContext template and collections
We are processing your request. We will contact you as soon as possible.
-
- Posts: 41
- Joined: Fri 12 Apr 2013 19:05
Re: dbContext template and collections
@chneumann,
by default dbcontext generates ICollection<>;
List is an implementation of it so you can safely cast to List<>.
by default dbcontext generates ICollection<>;
List is an implementation of it so you can safely cast to List<>.
Re: dbContext template and collections
@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?
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
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
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