Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all articles
Browse latest Browse all 1642

Commented Feature: Add a default for getutcdate() [96]

$
0
0
We use both the getdate() and getutcdate() for our DB. Would it be possible to change the "Validate default" switch statement for the "datetime" to read this:

```
case "datetime":
DateTime dt;
if(!DateTime.TryParse(Default, out dt))
Default = Default.ToLower().Contains("getdate()") ? "System.DateTime.Now" : Default.ToLower().Contains("getutcdate()") ? "System.DateTime.UtcNow" : string.Empty;
else
Default = string.Format("System.DateTime.Parse({0})", Default);
break;
```

I have changed it on our ttinclude file and it is working fine and generates the following code:

```
public MethodName()
{
EnqueueDateTime = System.DateTime.Now;
EnqueueDateTimeUTC = System.DateTime.UtcNow;
InitializePartial();
}
```
Comments: Thanks, this will be included in the next release.

Viewing all articles
Browse latest Browse all 1642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>