Questions about EF best practices and templates and buddy classes RRS feed

  • Question

  • Scenario:
    Setting the Code Generation Strategy property of the conceptual model to None. This turns off the default code generation.
    The code generation item adds one or more text template (.tt) files to the project.
    The text templates generate object-layer code. The generated files are added under the .tt files.

    Since I don’t want to write my own ORM mapping/persistence logic – and instead want to use the built-in designers within Visual Studio to help manage this. So I guess with that said I need to keep the EDMX file inside my project right? (I was creating the classes in a separate project so I wouldnt lose any annotations data).

    So I found out that I can create "buddy classes" so that I dont lose my data annotation data. Cool.

    Questions I have:
    What is the best way or best practice to keep all this working and in sync? (with buddy classes added)

    Should I create my EDMX and .tt templates in a different project? If so, that would still require an EDMX in the original project?

    Is it normal to just leave all Model classes under the <Template>.tt node? any reason to move it somewhere else?

    I am just trying to find an initial guide before I start coding my project. I know some are personal choices but I believe
    there are tons of info related to EF that I dont know since I am a beginner.


    Tuesday, October 18, 2011 6:59 PM