"nullable" vs "not null" - duplication in the model spec?
"nullable" vs "not null" - duplication in the model spec?
Properties have the "Nullable" setting under "General" - but under "Column" there is also a "Not Null" setting.
Isn't "Not Null" merely the opposite of "Nullable"? Why the need to configure and maintain this setting twice for every property/column-mapping?
If there is an edge-case where this is useful, perhaps the "Not Null" option could be empty by default? Using the opposite value of "Nullable" by default.
Isn't "Not Null" merely the opposite of "Nullable"? Why the need to configure and maintain this setting twice for every property/column-mapping?
If there is an edge-case where this is useful, perhaps the "Not Null" option could be empty by default? Using the opposite value of "Nullable" by default.
The General tab in the Properties window defines behaviour of a model class property.
The Column tab is taken into account in the following cases:
- generating DDL of the column when using Generate Database Script From Model
- comparing storage part of the model and database itself in Update Model From Database / Update Database From Model wizards
You may have a non-nullable class property for a nullable column in the database.
So, "Nullable" and "Not Null" are two conceptually different settings.
The Column tab is taken into account in the following cases:
- generating DDL of the column when using Generate Database Script From Model
- comparing storage part of the model and database itself in Update Model From Database / Update Database From Model wizards
You may have a non-nullable class property for a nullable column in the database.
So, "Nullable" and "Not Null" are two conceptually different settings.
Yes, but 98% of the time, one simply drives the other - which is why I'd suggest you make "Not Null" a Nullable, where NULL means use the default, e.g. !Nullable ... convention over configuration not only applies to code.Shalex wrote:So, "Nullable" and "Not Null" are two conceptually different settings.
Behaviour will be changed starting from the next build:
- the Validate Max Length attribute will be synchronized with the Length attribute of Column by default
- the Validate Required attribute will be synchronized with the Nullable attribute of Property by default
- implicit NOT NULL column's attribute in SQL script will be determined by the Nullable attribute of Property
New build of Entity Developer 4.2.110 is available for download now!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23135 .
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23135 .
Looks like you introduced a bug here - it's now impossible to control the ValidateRequired property at all, it's being automatically reset anytime you close and reopen the model project.
I believe you meant to auto-set the ValidateRequired property only when someone changes the value from the property-sheet in the user-interface?
Otherwise you can't control the ValidateRequired property at all...
I believe you meant to auto-set the ValidateRequired property only when someone changes the value from the property-sheet in the user-interface?
Otherwise you can't control the ValidateRequired property at all...
New build of Entity Developer 4.2.120 is available for download now!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23252 .
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23252 .
This problem still exists and was not fixed in this release.
Please send me an updated copy as soon as this issue has been resolved - I am currently completely stuck, since I already upgraded my project and integrated latest changes into my templates. Validation settings are changing on dozens of properties every time I open my project!
Please send me an updated copy as soon as this issue has been resolved - I am currently completely stuck, since I already upgraded my project and integrated latest changes into my templates. Validation settings are changing on dozens of properties every time I open my project!
Okay, there is definitely still a problem.
It looks like the issue occurs while upgrading the project from a previous version - I repeated this a few times to make sure, reverting the previous version of the project files, then simply opening the project, changing a property name somewhere, and saving. Then comparing against the previous version.
Every component property was changed - before:
And after:
As you can see, these were all Nullable=True, and now suddenly are also ValidateRequired=True. Looks like every individual property on every component now has ValidateRequired=True.
Many properties on classes have changed too - before:
And after:
It looks like every property in the HBML file that did not have a ValidateRequired value, is now set to True.
288 properties were changed in my project just from opening and re-saving it.
You probably should check the version number of the EDPS file when opening, and if it's 4.2.110, initialize missing ValidateRequired properties when reading the HBML file, the way they were initialized by default in 4.2.110...
It looks like the issue occurs while upgrading the project from a previous version - I repeated this a few times to make sure, reverting the previous version of the project files, then simply opening the project, changing a property name somewhere, and saving. Then comparing against the previous version.
Every component property was changed - before:
Code: Select all
<component class="MyApp.Entities.LocationFacility, MyApp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" p1:Guid="31ec8185-faaa-436b-b95b-fd01342507ea">
<property name="IndoorProductionSpace" type="Int32" p1:nullable="true" p1:Guid="0da5d7c2-c638-4242-bdb4-6cff6db0bcad">
<column name="" />
</property>
<property name="OutdoorProductionSpace" type="Int32" p1:nullable="true" p1:Guid="c978bb1b-e53c-4bf5-885d-0c867691bef0">
<column name="" />
</property>
<property name="IndoorStorageSpace" type="Int32" p1:nullable="true" p1:Guid="4e9c25ad-206e-4a80-820d-ef282cfda724">
<column name="" />
</property>
...
Code: Select all
<component class="MyApp.Entities.LocationFacility, MyApp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" p1:Guid="31ec8185-faaa-436b-b95b-fd01342507ea">
<property name="IndoorProductionSpace" type="Int32" p1:nullable="true" p1:ValidateRequired="True" p1:Guid="0da5d7c2-c638-4242-bdb4-6cff6db0bcad">
<column name="" />
</property>
<property name="OutdoorProductionSpace" type="Int32" p1:nullable="true" p1:ValidateRequired="True" p1:Guid="c978bb1b-e53c-4bf5-885d-0c867691bef0">
<column name="" />
</property>
<property name="IndoorStorageSpace" type="Int32" p1:nullable="true" p1:ValidateRequired="True" p1:Guid="4e9c25ad-206e-4a80-820d-ef282cfda724">
<column name="" />
</property>
...
Many properties on classes have changed too - before:
Code: Select all
<property name="Active" type="Boolean" p1:Guid="d5c0e864-df33-421f-a00a-d359488abdca">
Code: Select all
<property name="Active" type="Boolean" p1:ValidateRequired="True" p1:Guid="d5c0e864-df33-421f-a00a-d359488abdca">
288 properties were changed in my project just from opening and re-saving it.
You probably should check the version number of the EDPS file when opening, and if it's 4.2.110, initialize missing ValidateRequired properties when reading the HBML file, the way they were initialized by default in 4.2.110...