An exception occurred when you used entityframwork [6.1] for Cascade storage.

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.