C# DAL Generator for SQL Server and MS Access
C# DAL Generator is a .net desktop application that generates C# Data Access Layer for SQL Server and MS Access databases. The purpose of this application is to make software development easy. It creates C# classes (one per table) that contain methods for CRUD operations. The generated code can be used in web as well as desktop apps.
It creates C# classes (one for each table).
Supports SQL Server and MS Access.
The class contains all columns of the table as properties.
Data types have been handled nicely.
Creates methods for CRUD operations.
Sorting has been handled.
Pagination has been handled (SQL Server only).
Primary key is automatically detected for each table.
Composite primary key is supported.
Nullable columns have been handled.
Identity column has been handled.
Timestamp column has been handled.
Completely indented code is generated.
The generated code can be used in both desktop and web applications.
All the following data types of SQL Server are supported:
char, nchar, varchar, nvarchar, text, ntext, xml, decimal, numeric,
money, smallmoney, bit, binary, image, timestamp, varbinary, date,
datetime, datetime2, smalldatetime, datetimeoffset, time, bigint,
int, smallint, tinyint, float, real, uniqueidentifier, sql_variant
A sample web application has also been provided that is using the generated code. In this application one form (for employees) has been created. This app uses the generated data access layer without modifying a single line in the generated code.
C# Class: For each table one C# class is created that contains all columns of the table as properties.
Add Method: It is an instance method. It adds a new record to the relevant table. Nullable columns have been handled properly. If you don’t want to insert values in the nullable columns, don’t specify values for the relevant properties. Identity and timestamp columns cannot be inserted manually therefore these columns are skipped while inserting a record. Relevant property of the identity column is populated after record is inserted.
Update Method: It is an instance method. It updates an existing record. Identity and timestamp columns are skipped while updating a record.
Delete Method: It is a static method. It deletes an existing record. It takes primary key columns values as parameters.
Get Method: It is a static method. It gets an existing record (an instance of the class is created and all properties are populated). It takes primary key columns values as parameters.
GetAll Method: It is a static method. It gets all records of the relevant table. You can also specify search columns. If sorting/pagination is enabled then the relevant code will also be generated.
columns, table, generated, Access, record, Server, handled, application, Method, desktop, method, properties, relevant, Generator, values, instance, created, static, primary, column, columns, table, generated, Access, Server, handled, record, application, Method, desktop, method, properties, Generator, values, relevant, created, timestamp, existing, column, static