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

Closed Issue: Nullable uniqueidentifier with default value generates exception [109]

$
0
0
A table with a column having a nullable uniqueidentifier with a default value NULL:

[MyColumn] UNIQUEIDENTIFIER CONSTRAINT [DF_MyColumn] DEFAULT (NULL) NULL

will result in a Poco having the following line in the constructor:

MyColumn = Guid.Parse("NULL");

This will generate an exception.

The problem seems to be in the "CleanUpDefault" method (EF.Reverse.POCO.Core.ttinclude).

I was able to work around this thank to the new "UpdateColumn" function, but I think this should be fixed in the ttinclude.

Here's the workaround just in case:

UpdateColumn = (Column column, Table table) =>
{
if (column.PropertyType.ToLower() == "guid" && column.IsNullable && column.Default.ToLower().Contains("parse(\"null\")"))
{
column.Default = "null";
}
return column;
};
Comments: Released in v2.12.2

Viewing all articles
Browse latest Browse all 1642

Trending Articles



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