Skip to content

Commit 8068466

Browse files
committed
NH-3192 - Port-back register date function in MsSqlCeDialect
Squashed commit of 65f6488 and 203a98f
1 parent b00e8d9 commit 8068466

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/NHibernate/Dialect/MsSqlCeDialect.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ public MsSqlCeDialect()
4545
RegisterFunction("substring", new EmulatedLengthSubstringFunction());
4646
RegisterFunction("str", new SQLFunctionTemplate(NHibernateUtil.String, "cast(?1 as nvarchar)"));
4747

48+
RegisterFunction("date", new SQLFunctionTemplate(NHibernateUtil.DateTime, "dateadd(dd, 0, datediff(dd, 0, ?1))"));
49+
RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(second, ?1)"));
50+
RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(minute, ?1)"));
51+
RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(hour, ?1)"));
52+
RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(day, ?1)"));
53+
RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(month, ?1)"));
54+
RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(year, ?1)"));
55+
4856
DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.SqlServerCeDriver";
4957
DefaultProperties[Environment.PrepareSql] = "false";
5058
}

0 commit comments

Comments
 (0)