I have to convert a set of C# classes (class library) to SQL tables to be used by SQL Server, so that the data can be stored in a database and manipulated through the database.
The problem is that the number of these classes is big (more than 1000 classes), and it would take a long time to setup manually such a database schema (tables, indexes, stored procedures, etc.) – not to mention the class hierarchies that I need to maintain.
So, the question is:
Is there a tool that would help me to create a database schema from a C# class library?
I am not seeking for the perfect tool (but if there is such a tool I would be very happy to know), but for a tool that will help me at least create a starting point.
Please, also note that I would prefer your suggested solution to refer to version 2.0 of the .NET Framework, and being based on traditional practices (T-SQL code like: CREATE TABLE ...), although every suggestion is welcomed.
If you could use Visual Studio 2010 v4.0 framework there are some new capabilities to generate scripts using "Model First" and entity framework. This isn’t helpful for v2.0 obviously but I thought it was worth a mention.
The "Model First" feature lets you design a conceptual (CSDL) model in the Entity Designer, and then generate the storage (SSDL) model, as well as the mapping (MSL) between these. In addition, we also generate T-SQL scripts to create the database for you. To run the Model First wizard, just right-click on the Entity Designer surface, and choose "Generate Database from Model…". There’s an in-depth blog post here. Also, check this article out.