How to Specify Columntype in fluent nHibernate?

Posted by Bipul on Stack Overflow See other posts from Stack Overflow or by Bipul
Published on 2010-04-15T12:08:07Z Indexed on 2010/04/15 17:13 UTC
Read the original article Hit count: 282

Filed under:
|
|

I have a class CaptionItem

public class CaptionItem
    {
        public virtual int SystemId { get; set; }
        public virtual int Version { get; set; }        
        protected internal virtual IDictionary<string, string> CaptionValues {get; private set;}
}

I am using following code for nHibernate mapping

Id(x => x.SystemId);
            Version(x => x.Version);
            Cache.ReadWrite().IncludeAll();
            HasMany(x => x.CaptionValues)
                .KeyColumn("CaptionItem_Id")
                .AsMap<string>(idx => idx.Column("CaptionSet_Name"), elem => elem.Column("Text"))
                .Not.LazyLoad()
                .Cascade.Delete()
                .Table("CaptionValue")
                .Cache.ReadWrite().IncludeAll();

So in database two tables get created. One CaptionValue and other CaptionItem. In CaptionItem table has three columns

1. CaptionItem_Id     int
2. Text               nvarchar(255)
3. CaptionSet_Name    nvarchar(255)

Now, my question is how can I make the columnt type of Text to nvarchar(max)?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about nhibernate