1
如果我有以下的(削减为简洁起见)如何存储序列化列表<int>在FluentNhibernate
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类等等等等
刚刚编码,基于http://stackoverflow.com/questions/877924/fluent-nhibernate-bind-listint(我把修改在该职位,因为它说AsElement不是元素)序列化位仍然兴趣tbh,但你的权利,它“应”映射罚款到另一个表,但目前抛出“没有persister:System.Int32” – 2012-07-09 13:10:16
我遇到的主要问题是关于Persisence规格测试(http:// stackoverflow .com/questions/11397669/nhibernate-mappingexception-no-persister-for-system-int32)原来这不适用于这种绑定。愚蠢的时间浪费错误的一天:)写了一个不同的测试,并离开持续规格测试的列。 – 2012-07-09 21:40:23