C# class to Sql table

There are a lot of Sql table -> C# class methodologies, but I'm looking for the reverse.

Hypothetical situation:

I have N classes populated by some web service I consume, manipulate, then preform an action on. Now the boss wants said web service data persisted in a database.

I already have the classes defined, how can I quickly and easily (aka, lazily) generate a sql table off of each class?


Entity Framework and nHibernate both allow you to use them in "code-first" mode, which involves writing classes then generating databases.

There is a walk-through of this on ScottGu's blog here: http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

you can use MS Entity Framework Code First approach:

Code First allows you to define your model using C# or VB.Net classes, optionally additional configuration can be performed using attributes on your classes and properties or by using a Fluent API. Your model can be used to generate a database schema or to map to an existing database.

read more about it here: EF 4.1 Code First Walkthrough

Entity framework 4 has a code first development feature, I haven't used it so can't really recommend it

ScottGu blog

Need Your Help

Windows Phone 8.1 RT ColorAnimation

xaml windows-phone-8.1 storyboard winrt-xaml

I got a ControlTemplate with TargetProperty="Button" which uses a VisualStateManager and everything works fine except the ColorAnimation for the BitmapIcon.Foreground property.