zoukankan      html  css  js  c++  java
  • Exception during SaveEntity with LLBLGen Pro

    I wanted to update an entity with LLGLGen Pro by executing the adapter.SaveEntity() method and got an exception.

     

    Error

    An exception was caught during the execution of an action query: Cannot insert duplicate key row in object ‘dbo.Customer’ with unique index ‘UniqueApi’.
    The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.

     

    Cause

    This was caused by an unique constraint on a column ApiKey, but I was updating an existing “Customer” entity and the value for the “ApiKey”, was unique, but I forgot to set the IsNew property on the “Customer” entity to false. So LLGLGen wanted to insert a new record instead of updating the existing record.

     

    Solution

    By setting the “IsNew” property on the “Customer” entity to false, the exception was resolved.

  • 相关阅读:
    bootstrap
    移动视口,以及适配
    CSS线性渐变
    css之什么是bfc
    css 深入进阶之定位和浮动三栏布局
    webpack 4 技术点记录
    jQuery的学习总结
    jQuery 知识大全
    JS高级进阶
    正则
  • 原文地址:https://www.cnblogs.com/JamesLi2015/p/2976768.html
Copyright © 2011-2022 走看看