DbContext Generator and DataAnnotations RRS feed

  • Question

  • Hi,


    Im using dbcontext generator to create my classes from de edmx....

    but the problem is that every change in the edmx file generates the classes again, but any data annotation i created its erased.... thats okay...

    i just want to know if its possible to add DataAnnotations to the generated properties withtout have its erased... like in a partial class etc...

    or if there is another way to add this DataAnnotations..

    thank you


    creating the same question (http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/519bc043-3c50-4661-8207-07e0fd0104ea), since that forum is locked

    Thursday, April 28, 2011 3:18 AM


  • Hello,

    you can use partial class and buddy class as described here. Another way is modifying T4 template and generate data annotation automatically but that is too complex.

    Best regards,

    Thursday, April 28, 2011 10:56 AM