In a database application, the Data Access Layer acts as a bridge between the Data Tables (Relational Universe) and Business Objects (Business Domains); and in the .NET world, more often than not, these are built as an extension to ADO/.NET datasets/data tables.
DataQuicker extends the function and simplifies the development for building Data Access Layer, and provides the efficient and simple framework to construct your application. But it also bases on ADO.NET. I think there is nothing wrong in this approach, in fact, it will work very well for medium-sized and small database applications. It’s an Object Relational Mapper, as the name suggests, provides framework which maps Relational Data to Business Objects. As many of the OR Frameworks generate (or require you to create manually) classes (objects) based on domain models, their framework classes take care of mapping and formatting the data, so that it persists safely and accurately.
The difference from other O/R Mappings DataQuicker provides the model wraps Data Columns. Class FieldMapping
is the abstract
wrapper of different special columns type. It integrates (caches) the detailed information of the columns, such as Max Length, Regular Expressions (We should specify the Regex on class at the beginning), nullable, default value and so on. With the information, DataQuicker can check the validation of column data automatically without connecting the database. That means it is not necessary to validate the data manually and it will also speed up the application. In the way, the application completely replies on the design of database. The database changes, the validation will be changed simultaneously.
Additional, DataQuicker provides the accessory tools to analyze the database and generate the mapping classes for different database. It’s an efficient way to build high-performance database application.
As we know, usually, the project development is composed of three levels, UI, Business and DAL. And based on my past experience, DAL will cost us about 30% effort. And Business is 40%. Now, with DataQuicker, I'm sure it can cut down all the effort of DAL design and coding, additionally, it can also reduce some efforts on business coding.
Now, DataQuicker only supports SQL Server and Access, but I will do more soon.
Brief Code Samples
We assume that we have configured the DataQuicker correctly.
Insert a Record
Employees employee = Employees.CreateInstrance();
employee.LastName += "Jian";
employee.FirstName += "Liu";
employee.Title += "Software Engineer";
employee.TitleOfCourtesy += "Mr.";
employee.BirthDate += new DateTime(1982, 2, 7);
employee.HireDate += new DateTime(2005, 6, 28);
new SqlProvider().Insert(employee);
Update Orders
Employees employee = Employees.CreateInstrance(5);
Customers customer = Customers.CreateInstrance("HANAR");
Orders order = Orders.CreateInstrance(10248);
order.Employees = employee;
order.Customers = customer;
new SqlProvider().Update(employee);
Transaction
Employees employee = Employees.CreateInstrance();
employee.LastName += "Jian";
employee.FirstName += "Liu";
Orders order = Orders.CreateInstrance(10248);
order.Employees = employee;
SqlProvider provider = new SqlProvider();
provider.BeginTrans();
try
{
provider.Insert(employee);
provider.Update(order);
}
finally
{
provider.Commit();
}
Indeed, there are several articles included in the DataQuicker help document. We can also refer to NUnit project's source code for more code samples. So, if you're interested, why not download to try it immediately?
New Upgrade in the Next Version
Now I'm upgrading version 0.9.2 tensely. The changes obviously refer to:
- Remove query conditions setting on
FieldMapping
/EntityMapping
, but create a class Query
instead of them. So, in 0.9.2, when we're thirsty for data collection, we have to refer to the Query
object. The query can support aggregate function, group by clauses better than now. - Improvement on provider and analyzer components, using
IDbCommand
and IDataParameter
instead of combining SQL. That's more secure and efficient. - Separate entities when designing. Basically, if we only CRUD, it is not necessary to care about association of tables/view. Only query, so, if we want to get the association result, we have to set the association between tables/views dynamically when querying.
- Support multi-primarykey, but unfortunately, DataQuicker cannot manage multi-primarykey automatically. We have to set its value manually. For single primarykey, we also can set management way of
DQIncrease
/Guid
.
I wish you are satisfied with DataQuicker. If yes, please rate this article for us! Thank you.