Setting "Nullable Reference Types" to enable resolved this issue.RobertK wrote: ↑Sun 01 May 2022 16:45 There is still a bug in in the class models code generated by devart entity developer
The class models generated does not set nullible columns to null (question mark symbol) When the column are not set to nullible, Dotnet ef migration will set the column to required, see link below.
----
https://docs.microsoft.com/en-us/ef/cor ... onventions
By convention, a property whose .NET type can contain null will be configured as optional, whereas properties whose .NET type cannot contain null will be configured as required. For example, all properties with .NET value types (int, decimal, bool, etc.) are configured as required, and all properties with nullable .NET value types (int?, decimal?, bool?, etc.) are configured as optional.
Search found 111 matches
- Mon 02 May 2022 01:51
- Forum: Entity Developer
- Topic: BUG FOUND: Column always required when set to null
- Replies: 5
- Views: 11557
Re: BUG FOUND: Column always required when set to null
- Sun 01 May 2022 16:45
- Forum: Entity Developer
- Topic: BUG FOUND: Column always required when set to null
- Replies: 5
- Views: 11557
Re: BUG FOUND: Column always required when set to null
There is still a bug in in the class models code generated by devart entity developer
The class models generated does not set nullible columns to null (question mark symbol) When the column are not set to nullible, Dotnet ef migration will set the column to required, see link below.
----
https://docs.microsoft.com/en-us/ef/cor ... onventions
The class models generated does not set nullible columns to null (question mark symbol) When the column are not set to nullible, Dotnet ef migration will set the column to required, see link below.
----
https://docs.microsoft.com/en-us/ef/cor ... onventions
By convention, a property whose .NET type can contain null will be configured as optional, whereas properties whose .NET type cannot contain null will be configured as required. For example, all properties with .NET value types (int, decimal, bool, etc.) are configured as required, and all properties with nullable .NET value types (int?, decimal?, bool?, etc.) are configured as optional.
- Sat 05 Jun 2021 13:10
- Forum: Entity Developer
- Topic: How to configure navigation property naming format?
- Replies: 7
- Views: 3208
Re: How to configure navigation property naming format?
Ideally would want this navigation properties naming pattern
(example only, does not represent a realworld database design)
(example only, does not represent a realworld database design)
- Sat 05 Jun 2021 07:48
- Forum: Entity Developer
- Topic: How to configure navigation property naming format?
- Replies: 7
- Views: 3208
Re: How to configure navigation property naming format?
I'm still unable to correctly configure the navigation properties.
Example
You have two class models CreditCard and Address
CreditCard has a foreignkey called "BillingAddress"
>CreditCard
Id
Name
Number
...
BillingAddressId <-- foreign key to "Address"
--
>Navigation Properties
BillingAddress <-- (this is the correct name, it is the name of the column without "ID", by default this nagivation property is set to "Address")
>Address
Id
Name
...
>Navigation Properties
CreditCards_BillingAddress <-- (this is the correct name, it is the name of the foreignkey class model underscore column name without ID, by default this nagivation property is set to "CreditCards")
Example
You have two class models CreditCard and Address
CreditCard has a foreignkey called "BillingAddress"
>CreditCard
Id
Name
Number
...
BillingAddressId <-- foreign key to "Address"
--
>Navigation Properties
BillingAddress <-- (this is the correct name, it is the name of the column without "ID", by default this nagivation property is set to "Address")
>Address
Id
Name
...
>Navigation Properties
CreditCards_BillingAddress <-- (this is the correct name, it is the name of the foreignkey class model underscore column name without ID, by default this nagivation property is set to "CreditCards")
- Thu 03 Jun 2021 17:28
- Forum: Entity Developer
- Topic: URGENT: critical bug, generated code differs from diagram models
- Replies: 11
- Views: 4845
Re: URGENT: critical bug, generated code differs from diagram models
Was the bug fixed? Regenerate storage and mapping should fix it but it didn't, if there's an updated version, will try that.Shalex wrote: ↑Fri 28 May 2021 04:56Regenerate Storage and Mapping Wizard in EF Core Model will help to fix inconsistency of the existing model.RobertK wrote: ↑Wed 26 May 2021 18:17 It's a bug, so it's often inconsistent,... It was reported here viewtopic.php?f=32&t=45661&sid=c08446ac ... e1c6142c7b
Could you tell us the steps we should follow with a brand-new EF Core Model to reproduce inconsistency caused by Entity Developer?
- Wed 26 May 2021 18:17
- Forum: Entity Developer
- Topic: BUG FOUND: Column always required when set to null
- Replies: 5
- Views: 11557
- Wed 26 May 2021 18:17
- Forum: Entity Developer
- Topic: URGENT: critical bug, generated code differs from diagram models
- Replies: 11
- Views: 4845
Re: URGENT: critical bug, generated code differs from diagram models
It's a bug, so it's often inconsistent,... It was reported here viewtopic.php?f=32&t=45661&sid=c08446ac ... e1c6142c7bShalex wrote: ↑Tue 25 May 2021 13:04Settings of a class property should always be consistent with the ones of the corresponding column using both Model-First and Database-First approaches if you leave default settings created by Entity Developer. Please give us a step-by-step walkthrough we should follow to reproduce inconsistency in our environment.
- Sun 23 May 2021 06:13
- Forum: Entity Developer
- Topic: URGENT: critical bug, generated code differs from diagram models
- Replies: 11
- Views: 4845
- Sat 22 May 2021 17:58
- Forum: Entity Developer
- Topic: URGENT: critical bug, generated code differs from diagram models
- Replies: 11
- Views: 4845
Re: URGENT: critical bug, generated code differs from diagram models
Regenerate model and remapping still has issues as reported here viewtopic.php?f=32&t=45661
Alternative solution is to clear selection of the Not Null attribute in Column Editor: https://prnt.sc/10vafdl. <-- I can not do this because I don't know which column follows or does not the model diagram, it's very difficult determine if the generated code is correct aswell because it is not always consistent with the model diagram and I can't fix this either,its a very big problem.
Alternative solution is to clear selection of the Not Null attribute in Column Editor: https://prnt.sc/10vafdl. <-- I can not do this because I don't know which column follows or does not the model diagram, it's very difficult determine if the generated code is correct aswell because it is not always consistent with the model diagram and I can't fix this either,its a very big problem.
- Sat 22 May 2021 15:09
- Forum: Entity Developer
- Topic: BUG FOUND: Column always required when set to null
- Replies: 5
- Views: 11557
BUG FOUND: Column always required when set to null
v6.11.1219
Download zip file: https://filebin.net/t4kbp61pvwd7tnbq
Tried using regenerate storage and remapping, this should fix the issue, but it does not fix this issue?
ApplicationDbContext.cs: the error occurs in the address table, column "name", the model displays name is nullable, when the code is generated "name" is always required (line 130)
Generated code:
"modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").IsRequired().ValueGeneratedNever();"
It should be:
modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").ValueGeneratedNever();
Note
---------
EntityDeveloper should update the efml file from not-null="True" to not-null="False" but it does not do this (even when the model is regenerated using "regenerate storage and remapping" option)
Download zip file: https://filebin.net/t4kbp61pvwd7tnbq
Tried using regenerate storage and remapping, this should fix the issue, but it does not fix this issue?
ApplicationDbContext.cs: the error occurs in the address table, column "name", the model displays name is nullable, when the code is generated "name" is always required (line 130)
Generated code:
"modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").IsRequired().ValueGeneratedNever();"
It should be:
modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").ValueGeneratedNever();
Code: Select all
private void AddressMapping(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Address>().ToTable(@"Addresses", @"public");
modelBuilder.Entity<Address>().Property(x => x.Id).HasColumnName(@"Id").IsRequired().ValueGeneratedNever();
modelBuilder.Entity<Address>().Property(x => x.AccountId).HasColumnName(@"AccountId").IsRequired().ValueGeneratedNever();
modelBuilder.Entity<Address>().Property(x => x.Name).HasColumnName(@"Name").IsRequired().ValueGeneratedNever();
modelBuilder.Entity<Address>().Property(x => x.Company).HasColumnName(@"Company").ValueGeneratedNever();
......
}
---------
EntityDeveloper should update the efml file from not-null="True" to not-null="False" but it does not do this (even when the model is regenerated using "regenerate storage and remapping" option)
Code: Select all
<property name="Name" type="String" p1:nullable="True" p1:ValidateRequired="false" p1:Guid="e4076478-def9-42fe-9d3c-a7b3bf68b179">
<column name="" not-null="True" p1:unicode="True" />
- Tue 11 May 2021 07:54
- Forum: Entity Developer
- Topic: Storing JSON objects
- Replies: 3
- Views: 3082
- Tue 04 May 2021 12:15
- Forum: Entity Developer
- Topic: Storing JSON objects
- Replies: 3
- Views: 3082
Storing JSON objects
database: postgres
In Entity Developer, what column data type do you use to store JSON objects?
In Entity Developer, what column data type do you use to store JSON objects?
- Thu 15 Apr 2021 16:33
- Forum: Entity Developer
- Topic: Entity Developer vs DotConnect - whats the difference?
- Replies: 1
- Views: 2721
Entity Developer vs DotConnect - whats the difference?
1 What is the difference between entity developer and dot connect? https://www.devart.com/dotconnect/
2 Could you also design and generate code in dotconnect?
2 Could you also design and generate code in dotconnect?
- Thu 15 Apr 2021 16:31
- Forum: Entity Developer
- Topic: URGENT: critical bug, generated code differs from diagram models
- Replies: 11
- Views: 4845
Re: URGENT: critical bug, generated code differs from diagram models
Shalex wrote: ↑Thu 25 Mar 2021 17:48To fix the issue, please clear selection of the Not Null attribute in Column Editor: https://prnt.sc/10vafdl.RobertK wrote: ↑Tue 23 Mar 2021 14:49 The root cause of this issue (the efml information are saved incorrectly)
p1:nullable="True" <-- this is right
not-null="True" <-- this is wrong it should be saved as "not-null="False" because the column is set to nullable.
This will generated the incorrect mappingCode: Select all
<property name="MetaData" type="String" p1:nullable="True" p1:ValidateRequired="false" p1:Guid="6a3e0473-d959-4044-ac85-dce9ad4a18d4"> <column name="meta_data" not-null="True" sql-type="varchar" p1:unicode="True" />
Code: Select all
modelBuilder.Entity<Card>().Property(x => x.MetaData).HasColumnName(@"meta_data").HasColumnType(@"varchar").IsRequired().ValueGeneratedNever();
After this, the generated code would be:Also, you can run Regenerate Storage and Mapping to clear data in Column Editor for all properties: https://prnt.sc/10vaibd.Code: Select all
modelBuilder.Entity<Card>().Property(x => x.MetaData).HasColumnName(@"meta_data").HasColumnType(@"varchar").ValueGeneratedNever();
thanks this fixed the problem.
- Tue 23 Mar 2021 15:11
- Forum: Entity Developer
- Topic: URGENT: critical bug, generated code differs from diagram models
- Replies: 11
- Views: 4845
Re: Generated code differs from design models - 2
Note: this issue does not occur with only one class model, this issue affects hundred of tables, diagram does not match the code/table generated.