2
votes

Hey guys I'm trying to map my property name whose type in my code is String. When I crete the mapping class and try to assign a type to it I use this syntax:

Property(x => x.Name, m => { ... m.Type(new StringType()); ... });

And it's giving me an error, saying that the constructor call isn't valid. But this syntax is valid for all the other types I used (Int32, Boolean and DateTime).

I also tried typing m.Type<string>(); but that ended with an error in the tests I ran.

1
String is the default for String properties.Diego Mijelshon

1 Answers

3
votes

try this:

using NHibernate;

Property(x => x.Name, map =>
{
    map.Column("SomeColumnName");
    map.Access(Accessor.Property);
    map.Type(NHibernateUtil.String);
    });