NHibernate Restrictions.Ge(“ColumnName”,DateTime.Now)生成的SQL无效

NHibernate Restrictions.Ge(“ColumnName”,DateTime.Now)生成的SQL无效,nhibernate,fluent-nhibernate,sql-server-2008-r2,Nhibernate,Fluent Nhibernate,Sql Server 2008 R2,对于DateTime列,我有如下映射: ... Map(x => x.Created).Column("CREATED") .Access.Property() .CustomType<DateTime>() .CustomSqlType("datetime") .Not.Nullable(); ... 其中“startDat

对于DateTime列,我有如下映射:

...
Map(x => x.Created).Column("CREATED")
                   .Access.Property()
                   .CustomType<DateTime>()
                   .CustomSqlType("datetime")
                   .Not.Nullable();
...
其中“startDate”的类型为DateTime

在查看创建的SQL时,我看到了上述条件

...
    and Created = 2/14/2012 12:00:00 AM
...
这是不正确的。我希望NHibernate能够创造

...
    and Created = '2/14/2012 12:00:00 AM'
...
我还发现字符串类型也存在同样的问题

Map( x => x.ReceiverName).Column("UserName")
                         .CustomType("string")
                         .Access.Property()
                         .CustomSqlType("nvarchar(256)")
                         .Nullable()
                         .Length(256);
生成的SQL不会将字符串放在引号中:

...
    and UserName = Paul
...
而不是

...
    and UserName = 'Paul'
...
除了这些问题,映射工作得相当好


我做错了什么?

指定
.CustomSqlType(“nvarchar(256)”)
Length()渲染为noop。字符串和日期时间也不是customeTypes/customSqlTypes。也许纳特被他们搞糊涂了


删除除
映射(x=>x.ReceiverName).列(“用户名”).长度(256)以外的所有内容

如果删除
.CustomType()
,会发生什么情况?
...
    and UserName = 'Paul'
...