FluentNHibernate CustomType(“Binary”) MappingException
我在使用 NuGet(包版本:1.1.1.694)和 NHibernate 3.0 GA 上可用的最新 FluentNHibernate 构建映射实体时遇到问题
我想要达到的是 sql 类型:binary(64) 与 FluentNHibernate 以与数据库无关的方式(我不想使用 CustomSqlType)。
默认值是 varbinary(64) 我不想要。小写的“二进制”也会导致这种情况。
我的映射代码:
this.Map(x => x.PasswordHash)
.CustomType("Binary")
.Length(64)
.Not.Nullable();
在 NHibernate 映射 XML 文件中给出:
<property name="PasswordHash" type="Binary">
<column name="PasswordHash" length="64" not-null="true" />
</property>
生成架构时出现异常: 无法加载二进制类型。 System.TypeLoadException:无法加载 Binary 类型。可能的原因:未指定程序集名称。
在 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
另一方面 CustomType("StringClob") 有效。我缺少什么吗? 有没有办法让 FluentNHibernate .CustomType<>使用内置 NHibernate 类型?
(对于 AnsiChar 或 .NET 类型和数据库类型之间的其他非标准映射有用)?
I have an issue with mapping an entity with the latest FluentNHibernate build available on NuGet (package version: 1.1.1.694) and NHibernate 3.0 GA
What I am trying to reach is sql type: binary(64) with FluentNHibernate in a database-agnostic manner (I don't want to use CustomSqlType).
The default is varbinary(64) which I don't want. Lowercase "binary" leads to this as well.
My mapping code:
this.Map(x => x.PasswordHash)
.CustomType("Binary")
.Length(64)
.Not.Nullable();
Gives in NHibernate mapping XML file:
<property name="PasswordHash" type="Binary">
<column name="PasswordHash" length="64" not-null="true" />
</property>
Exception on generating schema:
Could not load type Binary.
System.TypeLoadException: Could not load type Binary. Possible cause: no assembly name specified.
at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
On the other hand CustomType("StringClob") works. Is there something I am missing ?
Is there a way to make FluentNHibernate .CustomType<> work with built-in NHibernate types ?
(Useful for AnsiChar, or other non-standard mapping between .NET type and database type) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您必须更改
sql-type
,而不是type
(流畅的语法可能是.SqlType("binary")
或类似的内容那)I believe you have to change the
sql-type
, not thetype
(fluent syntax is probably.SqlType("binary")
or something like that)