Obsolete
Details
Details
Assignee
Unassigned
UnassignedReporter
NoneN
NoneNLabels
Components
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created May 20, 2015 at 12:36 PM
Updated October 16, 2017 at 10:12 PM
Resolved October 12, 2017 at 2:11 PM
I use
UtcDateTimeType
and CustomSqlType "dateTime2" (configured with FluentNhibernate conventions).SchemaExport
generates the database-columns withdateTime2
- just as expected.But when I try to save an entity with an
DateTime
column havingDateTime.Min
as value, an SQL exception known fromdatetime
(without "2") gets thrown: {{ SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.}}It seems that
UtcDateTimeType
and sql-typedatetime2
are incompatible.I created an
UserType
which is basically a copy ofAbstractDateTime2SpecificKindType
with some ingredients fromDateTime2Type
andSqlTypeFactory.DateTime2
passed on to its base-classDateTimeType
.This works.
Attached you find the used source code.
I think it would be useful if this kind of user-type would ship with NHibernate itself. As the the internal constructor of
DateTime2Type
wasn't available to me but is you I think a proper built-in user-type is would be much cleaner.No tests except It-Saves-Stores-And-Loads-Correctly-For-Me-testing