Given a database schema, programmatically generate EF source code

We have a project driven by database design. And when someone makes a db modification, I would like to have my EF code updated. So, I was wondering if there is a way to programmatically generate EF source code given a database connection string. I then plan on attaching this generated EF source code to my solution. I don't need an exact solution right now, but if anyone can point me in the right direction, that would be great.

Thanks!

Answers


You could query the SQL Server system tables and generate code that way, perhaps using XML and XSLT or T4 templates.

http://msdn.microsoft.com/en-us/library/ms189082(v=sql.105).aspx


There are three approaches to Entity Framework Development: Database First, Model First, and Code First. You are using Database first.

Entity Framework Development Approaches

I recomend Julia Lerman's book Programming Entity Framework 2nd Edition.

The tutorial I've linked to is for Code First but it has a nice introduction to Repository and Unit Of Work Patterns which you will want to know when using any of the three approaches.


Need Your Help

CSS: Control space between bullet and <li>

html css html-lists

I'd like to control how much horizontal space a bullet pushes its &lt;li&gt; to the right in an &lt;ol&gt; or &lt;ul&gt;.

In Node.js, what does "var dnode = require('denode') mean when there is no file called 'denode'?

javascript node.js

The code for the question is the following, and I am confused by two lines in particular.