it seems that if I create a datetime field in llblgen, that it defaults to sql type datetime, which you would think would be OK.
BUT, EF CF must be assuming that a c# datetime is a datetime2 in the db (sql datetime's are not of sufficient precision/range so its not an unreasonable assumption), because I get errors when doing a commit, eg:
An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
The statement has been terminated.
and the sql for inserting (generated by EF) is:
exec sp_executesql N'INSERT [dbo].[MeetingAction]([Action], [ActionOnText], [ActionOnType], [ActionOnUserId], [Created], [DueDate], [MeetingId], [Modified], [Priority], [Status])
VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9)
SELECT [Id], [Timestamp]
FROM [dbo].[MeetingAction]
WHERE @@ROWCOUNT > 0 AND [Id] = scope_identity()',N'@0 nvarchar(1000),@1 nvarchar(1000),@2 int,@3 uniqueidentifier,@4 datetime2(7),@5 datetime2(7),@6 int,@7 datetime2(7),@8 int,@9 int',@0=N'TEST-Meeting Action-2015-12-08T12:42:22-482',@1=N'action on text',@2=0,@3='4E9E435B-07DD-49F7-8E91-5E669E691733',@4='2015-12-08 12:42:22.4937708',@5='0001-01-01 00:00:00',@6=3,@7='2015-12-08 12:42:22.4937708',@8=0,@9=0
DueDate is the new field that is defined as datetime/datetime in llblgen. Created & Modified are existing fields that are defined as DateTime/datetime2. (DueDate is defined as:
@5 datetime2(7)
and the value passed as:
@5='0001-01-01 00:00:00'
Obviously I can mannually resolve this in llblgen, but the default has a mismatch vs EF6.1 CF.
I'm using lllblgen design Nov2015
EF 6.1.3
C#4.0