We try to Switch from the EF Provider developed by Oracle to dotconnect for Oracle 8.4 to use it in EntityFramework.
After solving several issues during Migration I see a difference in the generated Code of the C# classes that is annoying.
Navigation Properties of 1-to-many-associations are of Type Collection<MyEntity>, which is fine, but in contrast to Oracles Provider dotConnect seems not to initialize those to an empty collection.
As a result the property returns null and therefore it is not possible to query it without checking for null.
Is it possible to configure the DbContext Code Generator to somehow add an initialization to Collection properties that creates an empty Collection?
regards
Peter
Initial NavigationProperty Collections to empty collection
Re: Initial NavigationProperty Collections to empty collection
Disabling ProxyGenerationEnabled seems to solve this issue, but I don't understand why the Generation of proxies should affect the initialization of collections.
Is this the right way to solve the issue?
regards
Peter
Is this the right way to solve the issue?
regards
Peter
Re: Initial NavigationProperty Collections to empty collection
We will improve a predefined DbContext template to initialize the collection if ProxyGenerationEnabled=True (default value) as well and notify you.
Re: Initial NavigationProperty Collections to empty collection
A deeper investigation concluded that the collection should not be initialized explicitly when ProxyCreationEnabled=True. Please use ProxyCreationEnabled=False.Shalex wrote:We will improve a predefined DbContext template to initialize the collection if ProxyGenerationEnabled=True (default value) as well and notify you.