Display a large string using Fluent NHibernate

I am working with Oracle DB and I am trying to map this class:

public class Book { public virtual int Id { get; private set; } public virtual string Author { get; set; } public virtual string Title { get; set; } public virtual string Text { get; set; } } 

With this display class:

 public class BookMap : ClassMap<Book> { public BookMap() { Id(x => x.Id); Map(x => x.Author); Map(x => x.Title); Map(x => x.Text); } } 

But the type of column that it generates me is NVARCHAR (255), and the Book.Text property has more than 255 characters.

How can I map it to a type that can contain a very large string (e.g. CLOB)?

+6
c # nhibernate fluent-nhibernate nhibernate-mapping
source share
1 answer
 public class BookMap : ClassMap<Book> { public BookMap() { Id(x => x.Id); Map(x => x.Author); Map(x => x.Title); Map(x => x.Text).CustomSqlType("CLOB"); } } 

or

 public class BookMap : ClassMap<Book> { public BookMap() { Id(x => x.Id); Map(x => x.Author); Map(x => x.Title); Map(x => x.Text).Length(500); // nvarchar(500) } } 
+9
source share

All Articles