Exception: system. Errors: Multiplicity constraint violated. The role 'incomeitem _ createby_source 'of the relationship 'familyfinancial. Infrastructure. repository. Comment 'has multiplicity 1 or 0 .. 1
The general meaning is: the multi-factor constraint is violated, and the attribute that appears is createby;
Shows the entity design:
Monthincome is an aggregate root entity:
It has an incomeitem object set:
Use fluentapi for ing (before exception resolution ):
There is no problem with the relationship between the databases generated through this configuration, but it is executed to the context. set <t> (). the above exception occurs when the add (entity) method is used. After a long time, find a method to solve the problem, such:
After the configuration is changed, the problem is solved. Although the problem has been solved, I still don't understand why the previous configuration is not working. If anyone knows it, please let us know one or two. Thank you very much!
PS: There is also a small problem. The conversion from the datetime2 data type to the datetime data type produces a value out of the range;
This exception is caused by excessive data. You only need to change the datetime field type in the database to datetime2;
However, the datetime. Now value used in the program should not be assigned. In addition, it seems that the time attribute field is also used in the previous project, and there is no problem in saving it. I don't know why ~~~
An exception occurred when you used entityframwork [6.1] for Cascade storage.