DateTime Default not working correctly

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: DateTime Default not working correctly

Post by Shalex » Tue 23 May 2017 09:19

The Auto-Sync value (Never / OnInsert / OnUpdate / Always) specifies if the property is automatically synchronized. Depending on the target database server, synchronization is done via the RETURNING clause or separate SELECT in the generated SQL statement. You can check this via dbMonitor.

OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

Re: DateTime Default not working correctly

Post by OutOfTouch6947 » Thu 01 Jun 2017 14:57

I sitll would like to see a detailed explanation of AutoSync.
I set AutoGenerated = true and AutoSynch to OnInsert since I don't understand exactly what this value does, and my database constraints require the modified date not be null.
OutOfTouch6947 wrote:I didn't set the AutoGeneratedValue or Auto-Snc.
Where can I find an detailed explanation of AutoSync Mode?
Shalex wrote:
OutOfTouch6947 wrote:Here is the insert statement with the CreatedDate and ModifiedDate added back into the models and the values are not defaulting correctly in the backend, so the model must be passin in some junk value. [...]
1. Did you set the following attributes for your CreatedDate and ModifiedDate properties in *.lqml?
CreatedDate: AutoGeneratedValue=True, Auto-Sync=OnInsert
ModifiedDate: AutoGeneratedValue=True, Auto-Sync=OnUpdate

2. Specify (via dbMonitor) the values of parameters used in the INSERT statement for "CreatedDate" and "ModifiedDate" columns.

3. Send us a small test project with the corresponding DDL/DML script for reproducing the issue in our environment.

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

Re: DateTime Default not working correctly

Post by Shalex » Fri 02 Jun 2017 13:14

OutOfTouch6947 wrote:I sitll would like to see a detailed explanation of AutoSync.
Please refer to our response on Tue May 23, 2017 in this thread.
OutOfTouch6947 wrote:I set AutoGenerated = true and AutoSynch to OnInsert since I don't understand exactly what this value does, and my database constraints require the modified date not be null.
With these settings, the date value should be generated in the database (via default value of column, via trigger, etc), then it will be returned to your program via RETURNING clause or separate SELECT statement.

If this doesn't help, please upload a small test project with the corresponding DDL/DML script for reproducing to our ftp server (ftp://ftp.devart.com, credentials: anonymous/anonymous ) or to any file exchange server so that we could download it from there.

OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

Re: DateTime Default not working correctly

Post by OutOfTouch6947 » Thu 15 Jun 2017 22:10

Thanks for the info.

Post Reply