dbContext template and collections

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
chneumann
Posts: 1
Joined: Tue 23 Oct 2018 16:41

dbContext template and collections

Post by chneumann » Tue 23 Oct 2018 17:35

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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: dbContext template and collections

Post by Shalex » Fri 26 Oct 2018 18:56

We are processing your request. We will contact you as soon as possible.

figueiredorj
Posts: 41
Joined: Fri 12 Apr 2013 19:05

Re: dbContext template and collections

Post by figueiredorj » Mon 29 Oct 2018 14:27

@chneumann,
by default dbcontext generates ICollection<>;
List is an implementation of it so you can safely cast to List<>.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: dbContext template and collections

Post by Shalex » Thu 08 Nov 2018 14:33

@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?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: dbContext template and collections

Post by Shalex » Sat 20 Jun 2020 19:57

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

Post Reply