Entity Developer generates ID attribute
Entity Developer generates ID attribute
Hi
Hope someone can help me.
Im trying to make a model, and then generate code-first code.
Like this:
https://ibb.co/gEtGo7
The problem is that when I make a association Entity Developer generates a ID attribute.
So when I generate the code-first code, the ID attribute is also there, but also the navigation property.
Is the ID necessary?
Regards
Jakob
Hope someone can help me.
Im trying to make a model, and then generate code-first code.
Like this:
https://ibb.co/gEtGo7
The problem is that when I make a association Entity Developer generates a ID attribute.
So when I generate the code-first code, the ID attribute is also there, but also the navigation property.
Is the ID necessary?
Regards
Jakob
Re: Entity Developer generates ID attribute
Please give us the following information:
1) you want not to add a foreing key property (CityId) to the child class (Customer) when creating an association, don't you?
2) do you need to avoid creating a class property (in model) or a table column (in database)?
3) the name of your ORM (EF6 *.edml, EF Core *.efml, etc)
4) a target database server (SQL Server, Oracle, etc)
1) you want not to add a foreing key property (CityId) to the child class (Customer) when creating an association, don't you?
2) do you need to avoid creating a class property (in model) or a table column (in database)?
3) the name of your ORM (EF6 *.edml, EF Core *.efml, etc)
4) a target database server (SQL Server, Oracle, etc)
Re: Entity Developer generates ID attribute
Hi Shalex
1. Yes
2. I don't want the class property (CityID). Dont care about if its in the database
3. EF6
4. SQL Server
Regards
1. Yes
2. I don't want the class property (CityID). Dont care about if its in the database
3. EF6
4. SQL Server
Regards
Re: Entity Developer generates ID attribute
Please open Model Settings and clear selection of the "Include foreign key columns in the model" option. Does this help?
Re: Entity Developer generates ID attribute
That did´nt help.. Still generates the property...
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Entity Developer generates ID attribute
Have you recreated your objects after you cleared the "Include foreign key columns in the model" check box?Jakobvj wrote:That did´nt help.. Still generates the property...
Please also provide the following information:
1. When exactly the CityId property is added?
2. Do you generate the model from a database or do you add classes, associations, etc. yourself?
If you build the model from the database, you need to generate these classes again after clearing the check box. Delete the classes from the model and add them again.
If you create classes and associations manually, open Mapping Details for an association and configure its mapping. After this, delete this property from the class. When adding classes from the database, this is done automatically.
Re: Entity Developer generates ID attribute
Yes, I can see the foreign key is not included when making a model from the database...
Is it correct, that after creating the association, I can just delete the key from the model?
I just don't see a reason why the id is added when I have NOT checked the include foreign key in model
Is it correct, that after creating the association, I can just delete the key from the model?
I just don't see a reason why the id is added when I have NOT checked the include foreign key in model
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Entity Developer generates ID attribute
Yes, you can delete the key and configure the association.Jakobvj wrote:Is it correct, that after creating the association, I can just delete the key from the model?
We will investigate this situation and post here about the results.Jakobvj wrote:I just don't see a reason why the id is added when I have NOT checked the include foreign key in model
Re: Entity Developer generates ID attribute
The bug with applying the "Include foreign key columns in the model" model setting by Create Model Wizard is fixed (SQL Server): https://www.devart.com/entitydeveloper/ ... story.html.