1
votes

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) ?

1

1 Answers

0
votes

I believe you have to change the sql-type, not the type (fluent syntax is probably .SqlType("binary") or something like that)