Is there any way when more details / information occurs when this invalid operation during the option SaveChanges () Operation failed: The relationship could not be changed because one or more foreign key properties are non-tapable when a change is made in a relationship, So the related foreign-major property is set to zero value. If the foreign key does not support zero values, then a new relationship should be defined, foreign-key properties should be assigned other non-blank values, or unrelated objects should be removed.
I am not removing anything from DB, such questions are not equal to me. This message is very self-explanatory, true, but I do not see the error in code and if the exception has given more information about which property and which foreign key is in question.
Edit - I have checked the innerexception and it is empty. For example, if you have the next structure:
public class client { Public at ClientID {Received; Set; } Public string name {get; Set; } Public Internet ClientTypeid {Received; Set; } Public ClientType ClientType {get; Set; }} Public class client type {public Internet client ID {get; Set; } Public string description {get; Set; For example, if you are changing the "Name" property, then your property "ClientType" must be blank, otherwise it will try to create, update or delete your client type. Then just SaveChanges ();
Before setting the client type to clear, if you post more of your code, we can ensure that this is happening accurately, but this was my guess < / P>
No comments:
Post a Comment