"a referential integrity constraint violation occurred the property values) on the other end" Code Answer's

You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "a referential integrity constraint violation occurred the property values) on the other end" answered properly. Developers are finding an appropriate answer about a referential integrity constraint violation occurred the property values) on the other end related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like a referential integrity constraint violation occurred the property values) on the other end. Enter your desired code related query in the search bar and get every piece of information about C# code related question on a referential integrity constraint violation occurred the property values) on the other end. 

a referential integrity constraint violation occurred the property values) on the other end

By Jean DinhJean Dinh on Sep 15, 2020
I came across a very similar exception:

"A referential integrity constraint violation occurred: 
The property value(s) of 'ObjectA.PropertyX' on one end of a relationship 
do not match the property value(s) of 'ObjectB.PropertyY' on the other end."
The reason was this: The client side of the web API sent a PUT request with the entire object including the navigation property (in this example ObjectA (more correctly ObjectB.ObjectA) was a navigation property and was fully supplied by the client). This occurs because the client receives the entire object from the server and bounces it as-is back to the server with minor changes.

On the other hand, the ObjectB.PropertyY had just been changed (this was the reason for the PUT request in the first place).

Since ObjectB.PropertyY was a reference to the same object ObjectA (a foreign key), EF tried to reconcile this and failed with the above exception.

The solution was simple:

ObjectB.ObjectA = null;
before the SaveChanges() solved this completely.

I hope this helps someone.

Source: stackoverflow.com

Add Comment

0

All those coders who are working on the C# based application and are stuck on a referential integrity constraint violation occurred the property values) on the other end can get a collection of related answers to their query. Programmers need to enter their query on a referential integrity constraint violation occurred the property values) on the other end related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about a referential integrity constraint violation occurred the property values) on the other end for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of a referential integrity constraint violation occurred the property values) on the other end while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "a referential integrity constraint violation occurred the property values) on the other end". Visit this developer's friendly online web community, CodeProZone, and get your queries like a referential integrity constraint violation occurred the property values) on the other end resolved professionally and stay updated to the latest C# updates. 

C# answers related to "a referential integrity constraint violation occurred the property values) on the other end"

View All C# queries

C# queries related to "a referential integrity constraint violation occurred the property values) on the other end"

a referential integrity constraint violation occurred the property values) on the other end .net core 3 entity framework constraint code first image field C# verify "no other" call xunit how to detected WindowCloseEvent in other window wpf how to disable all other components in gameobject in unity lat and long positions too close to each other unity c# how to make colliders collide with some things but not other in unity c# calculate start and end by subnet Unity how end a couroutine c# print decimal with zero at the end How to get 4 end len in string c# linq unique count property property shortcut visual studio find class property with string C# class selector to property in asp net core dropdown c# reflection get property value array telerik wpf gridviewcombobox itemsource property on item autofixture ignore property wpf binding to static property in code behind c# every property of object linq if property is null then c# how to make an array of excisting PictureBoxes using the Type property in C# Window App Form source a listbox by property of object c# c# json contains property C# traverseall elements in class property CS0120: An object reference is required for the non-static field, method, or property 'PlayerControls.currentState' wpf get dependency property in code group c# objects by object property c# asp.net only displays name of property vb.net databinding not working on custom property json serializer skip property c# linq select only unique values from list c# method returns multiple values Print arraylist values to console unity c# sum object values enum get all values C# unity get inspector rotation values C# int array initial values find the values of dictionaries in C sharp hdrp lit change emmision values

Browse Other Code Languages

CodeProZone