Automatically truncating strings in NHibernate / SQL Server

前端 未结 1 327
忘了有多久
忘了有多久 2021-01-13 14:30

I have a nvarchar(2000) column in a SQL Server 2005 database, and have mapped this into NHibernate as:



        
相关标签:
1条回答
  • 2021-01-13 15:06

    Create a custom User Type and which truncates the string if it's longer than 2000 chars. Here is sample of creating User Type

    <property name="Query" type="Common.Nhibernate.Types.StringTruncType, Common" column="`Query`" type="String" length="2000" not-null="false"/>
    
    0 讨论(0)
提交回复
热议问题