Skip to content

Commit 100074a

Browse files
committed
NH-3762 - DateType should not set DbType property, as it can break some dialects
1 parent 68c6b34 commit 100074a

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/NHibernate/Type/DateType.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,10 @@ public override System.Type ReturnedClass
5353

5454
public override void Set(IDbCommand st, object value, int index)
5555
{
56-
var parm = st.Parameters[index] as IDataParameter;
56+
var parm = (IDataParameter) st.Parameters[index];
5757
var dateTime = (DateTime)value;
58-
if (dateTime < customBaseDate)
59-
{
60-
parm.Value = DBNull.Value;
61-
}
62-
else
63-
{
64-
parm.DbType = DbType.Date;
65-
parm.Value = dateTime.Date;
66-
}
58+
if (dateTime < customBaseDate) parm.Value = DBNull.Value;
59+
else parm.Value = dateTime.Date;
6760
}
6861

6962
public override bool IsEqual(object x, object y)
@@ -127,7 +120,7 @@ public override object DefaultValue
127120

128121
public override string ObjectToSQLString(object value, Dialect.Dialect dialect)
129122
{
130-
return '\'' + ((DateTime)value).ToShortDateString() + '\'';
123+
return "\'" + ((DateTime)value).ToShortDateString() + "\'";
131124
}
132125

133126
public void SetParameterValues(IDictionary<string, string> parameters)

0 commit comments

Comments
 (0)