NHibernate mapping index out of range

后端 未结 1 699
礼貌的吻别
礼貌的吻别 2021-01-21 20:28

I have two classes:

 public class CarModel
    {
        public virtual int Id { get; set; }
        public virtual string model_name { get; set; }
    }
         


        
1条回答
  •  爱一瞬间的悲伤
    2021-01-21 20:35

    The issue here is in a doubled column mapping:

        
     
    

    Both properties (valueType and Reference) are targeting same column. Which is possible but not for Write operations. We have to make one of them readonly using insert="false" and update="false"

        
     
    

    So, now we do have access to both properties, mapped to same column, but the INSERT, UPDATE will target that column only once. Because that was the original issue here: ...ndex was out of range. Must be non-negative and less than the size of the collection...

    Also check the similar issue: https://stackoverflow.com/a/24248912/1679310

    0 讨论(0)
提交回复
热议问题