I'm searching for an easy CRUD (or DAL) Generator for C#. I'm not going anything heavyweight since i have have only a few tables inside a SQL Server 2008 database.

Any suggestions? I understand .netTiers, but it's a significant amount of for which I want.


UPDATE: I attempted LINQ to SQL also it does not work nicely for me.

I have tried personally SubSonic on past projects, it's lightweight and simple to use.

They provide an easy tutorial video also it should take a maximum of ten minutes to have it completely setup. I suggest watching the other half from the video that are responsible for Web Application Projects since it demonstrates how to produce a personalized Visual Studio button that produces the DAL for you personally if you click it rather than utilizing a custom build-provider because they suggest in first 1 / 2 of the recording.

It provides a number of ways to gain access to your computer data, Active Record, producing typed saved-methods and sights, or a query language which you can use.

After utilizing it, I've discovered a couple of eccentricities:

  • If you are using a produced saved-procedure without a parameter, it'll throw a NullReferenceException. A workaround is to produce a dummy parameter that is not utilized in the process
  • The DeepSave() function doesn't work in the present 2.1 version, you will need to individually save data from became a member of tables
  • If you use a coditional (e.g. Where(Tag.Columns.TagName).IsEqualTo("subjective"), make certain you apply the string value Tag.Columns.TagName to reference the column - otherwise the best is going to be tossed by trying to make use of the Column.Schema

Visual Studio has a code generator that hardly anybody is aware of known as T4.

You need to have the ability to utilize it relatively easily to produce CRUD templates.


And here's a good example how: http://www.olegsych.com/2008/01/how-to-use-t4-to-generate-crud-stored-procedures/

How about utilizing a DataSet produced while using DataSet designer. I recall in the Past (.Internet 1. and 1.1), we'd drag a DataAdapter to the design surface, specify the Choose query, and also the Place, Update and Remove queries could be produced for all of us, in line with the Choose query.

LINQ To SQL is simple and it is included in .Internet 3.5 SP1.

The Visual Studio magicians can create an easy CRUD application for you personally.

Drag a datagrid in your form, click on the connection property and stick to the magicians after that.

Not guidelines but is straightforward and works...

Just just in case money is not a large concern, I have had positive results with templates in CodeSmith.

You will find lots of sample templates available for CRUD procedures and will also read from your database.

Perhaps you have attempted the Dynamic Data Web Application (uses LINQ to SQL) or even the Dynamic Data Organizations Web Application (uses Entity Framework).

MSDN: Walkthrough: Creating a New ASP.NET Dynamic Data Web Site Using Scaffolding

Have a look at Codesmith. The 2.6 version is free of charge and also the later versions are for sale.

Take a look at LLBLGen Professional, I recommend it. It's not free, although not costly. You will get ready to go (writing code) inside an hour, and also the templates it arrives with generate code that may do essentially whatever you want. It's so nice (and productive) not to even need to consider database interface code any longer.