EF creates labels that can't be broken

Source: Internet
Author: User

Application Scenarios:

When developing with EF's datebase fitst pattern, entities have T4 files that are generated from the database and are regenerated every time they are saved, and if we add validation tags to the entity classes that have T4 generated, then the save is lost.

Solution:

  

1[Metadatatype (typeof(Openguilogvalidate))]//let Openguilog share openguilogvalidate metadata information2      Public Partial classOpenguilog3     {4     }5 6      Public classopenguilogvalidate7     {8[Stringlength (5, errormessage ="")]9 [Required]Ten          Public stringName {Get;Set; } One  A}

EF creates labels that can't be broken

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.