Two minor problems encountered during ASP. net mvc 2 Programming

Source: Internet
Author: User

 

UseMVC2Develop oneWebThere are two minor problems with the application. Here we will record it:

 

(1) PassADO. NET Entity Data ModelWhen designing the database structure, if you want to make the newly added or modified content take effect, you must first automatically generate the database script and connect to the database for execution, to ensure Database Synchronization, there is no need to delete the original database content during synchronization and you can directly update it. However, if you wantControllerTo automatically createViewIn the strong type drop-down box, there is no newly added class. In this case, we can compile or debug the new class. Otherwise, we cannot generate an automatic foreground.CodeLa~

 

( 2 ) Pass ADO. NET Entity Data Model When designing the database table structure, if we need to modify the constraint attribute of the table field, it may cause the modification to be updated to the database, and the code page is correct. However, each execution Xxxrepostory. Save () Will cause an exception. The prompt content is probably that the XX field does not comply with the XX constraint. What I encounter is that it cannot be inserted. Null To the XX field, I tried it last night. N Times, but the same problem still occurs. Today I re-wrote an identical class, then updated it, and conducted the exclusion verification. The strange thing is that yesterday's problem was solved by myself ...... Really Khan, according to the first experience, it may be because MVC Some places in the architecture are not completely handled according to my updates, which leads to inconsistency. Restart the architecture and the recompilation may be consistent ......

 

Sometimes, some problems are quite strange, but in terms of this experience, I have understood the principle that architecture makes development simple, but at the cost of freedom, at the same time, we also have a responsibility for ensuring the normal operation of the architecture! This also shows that while enjoying the convenience brought by the architecture, we must always be skeptical and learn as much details as possible about the architecture. Otherwise, we will have a lot of trouble.~

 

Hope to help you ~

 

PS: The second problem is that the attribute of this fieldStoregeneratedpatternThe value isIdentity, SetNoneAnd can be inserted normally.

 

 

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.