"nullable" vs "not null" - duplication in the model spec?

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

"nullable" vs "not null" - duplication in the model spec?

Post by mindplay » Mon 19 Dec 2011 18:56

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.

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

Post by Shalex » Fri 23 Dec 2011 08:34

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.

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Fri 23 Dec 2011 15:00

Shalex wrote: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
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 27 Dec 2011 17:31

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
We will post here when the corresponding build of Entity Developer is available for download.

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Wed 28 Dec 2011 14:57

Fantastic, thank you! :-)

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

Post by Shalex » Thu 12 Jan 2012 16:47

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 .

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Thu 19 Jan 2012 21:46

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...

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

Post by Shalex » Tue 24 Jan 2012 10:35

mindplay wrote:it's now impossible to control the ValidateRequired property at all, it's being automatically reset anytime you close and reopen the model project
We have reproduced the bug. We will post here when it is fixed.

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

Post by Shalex » Tue 24 Jan 2012 17:00

The bug with resetting the Validate Required property after reopening model is fixed. We will post here when the corresponding build of Entity Developer is available for download.

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

Post by Shalex » Fri 27 Jan 2012 14:21

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 .

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Wed 01 Feb 2012 15:40

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!

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

Post by Shalex » Thu 02 Feb 2012 12:45

We cannot reproduce the problem in our environment using Entity Developer v 4.2.120. Please send us a small test model and specify the steps we should follow to reproduce the bug.

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Thu 02 Feb 2012 14:18

Oddly, today I can't reproduce the problem anymore - not in the project that failed yesterday, and not in an isolated sample project either.

Perhaps rebooting my machine did something?

I'll let you know if this problem comes back...

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Thu 02 Feb 2012 14:39

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:

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>
      ...
And after:

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>
      ...
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:

Code: Select all

<property name="Active" type="Boolean" p1:Guid="d5c0e864-df33-421f-a00a-d359488abdca">
And after:

Code: Select all

<property name="Active" type="Boolean" p1:ValidateRequired="True" p1:Guid="d5c0e864-df33-421f-a00a-d359488abdca">
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...

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Fri 03 Feb 2012 14:23

Any ideas?

Post Reply