<p>Is there a way to take over the Entity Framework class builder? I want to be able to have my own class builder so i can make some properties to call other methods upon materialization or make the entity classes partial.</p>

[{'answer_id': 39410, 'author': 'Artem Tikhomirov', 'author_id': 2313, 'author_profile': 'https://Stackoverflow.com/users/2313', 'pm_score': 3, 'selected': True, 'text': '<p>Actually they are already in partial classes. See <a href="http://msdn.microsoft.com/en-us/library/bb738612.aspx" rel="nofollow noreferrer">MSDN</a></p>\n'}, {'answer_id': 57687, 'author': 'Tyler', 'author_id': 5642, 'author_profile': 'https://Stackoverflow.com/users/5642', 'pm_score': 0, 'selected': False, 'text': "<p>I'll add that not only can you can tack on your own class <strong>partial classes</strong> to those emitted by the Entity Framework, but you can also write out all the <strong>partial methods</strong> created by the generated code.</p>\n\n<p>IE. There'll be a lot of partial method code which get called but the method itself in the generated code isn't really implemented. For that you can write a partial method to catch events when properties change and such. It's not a terrible way to handle some business rules.</p>\n"}, {'answer_id': 147633, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p><a href="http://msdn.microsoft.com/en-us/library/system.data.entity.design.entityclassgenerator.aspx" rel="nofollow noreferrer">System.Data.Entity.Design.EntityClassGenerator</a>, is the type used in VS to generate the object layer from your .edmx file, and it is the type used by EdmGen.exe to generate the object layer from a .csdl file. Below I listed the 3 ways that you can affect the generated code.  The 3rd option requires that you call EntityClassGenerator yourself.  You can get your code to run automatically in VS sort of like an SingleFileGenerator by <a href="http://blogs.msdn.com/adonet/archive/2008/06/20/how-to-use-a-t4-template-for-view-generation.aspx" rel="nofollow noreferrer">using this technique</a> presented by Sanjay.</p>\n\n<ol>\n<li>Add code to the types through <strong>partial classes</strong></li>\n<li>Add code to the <strong>partial methods</strong> that are called by the generated classes</li>\n<li>Hook the <strong>code generation events</strong> to inject code directly into the properties and types as they are generated.  See Danny\'s <a href="http://blogs.msdn.com/dsimmons/archive/2007/09/01/ef-codegen-events-for-fun-and-profit-aka-how-to-add-custom-attributes-to-my-generated-classes.aspx" rel="nofollow noreferrer">blog post</a> for an example</li>\n</ol>\n'}]
['https://Stackoverflow.com/questions/39403', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4171/']