Page 1 of 1

NHibernate IUserType (type and definition)

Posted: Tue 08 Apr 2014 13:56
by ruda
NHibernate lets you create a IUserType a ready class. For example, create a IUserType to System.Uri.

Then create a class called the project UriType Implementing IUserType and setting the type as System.Uri.

On the property in the class it is the type System.Uri, but the Type of NHibernate is UriType type. Works perfectly, but I have no way to define the two Entity Developer. If I define UriType he puts on the property UriType, but should be the System.Uri.

How do I set the property type and the type of nhibernate?

Code: Select all

Map(x => x.Test)    
                .Column("Test")
                .CustomType("NhibernateExt.UriType")
                .Access.Property()
                .Generated.Never()
                .CustomSqlType("varchar")
                .Length(100);

public virtual System.Uri Test
        {
            get;
            set;
        }

Re: NHibernate IUserType (type and definition)

Posted: Mon 14 Apr 2014 12:00
by Shalex
Please set System.Uri explicitly in the Type property of HibernateProperty. Save the model and regenerate the code. Is that what you mean?