我是靠谱客的博主 霸气往事,最近开发中收集的这篇文章主要介绍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.

最后

以上就是霸气往事为你收集整理的Exception during SaveEntity with LLBLGen Pro的全部内容,希望文章能够帮你解决Exception during SaveEntity with LLBLGen Pro所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部