如果我有以下(为简洁起见)
public class TempCartMap : ClassMap<TempCart>
{
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Products); // < This one
}
[Serializable]
public class TempCart {
public TempCart(){
Products = new List<int>();
}
public virtual IList<int> Products { get; set; }
}
我看过(http://www.philliphaydon.com/2012/06/using-nhibernate-with-servicestack/)和(http://www.philliphaydon.com/2012/03/ormlite-blobbing-done -with-nhibernate-and-serialized-json/),但是是否有一种更短、更简单、更快的方法让 NHibernate 像上面那样对列进行序列化和反序列化。创建一个新的 IUserType 类等似乎有点矫枉过正。