background preloader

Data Access Layer

Facebook Twitter

Data Access Layer in C# using Repository and Data Mapper – Part 4. An Elegant C# Data Access Layer using the Template Pattern and Generics. The GOF Template pattern coupled with .NET 2.0 Framework generics provides an awesome synergistic alliance.

An Elegant C# Data Access Layer using the Template Pattern and Generics

This article demonstrates how to drastically reduce the amount of code required in building a data access layer. Less code to debug... less code to break... less code to maintain... what could be better? Part I: Introduction to the Template Pattern To get started, let's talk about the GOF Template pattern. As with all GOF patterns, its primary purpose is to separate out what changes in your code from what does not change. Here is an example. Public class DoSomething private int m_number; public int GetTheFancyNumber() int theNumber = m_number; // DO LOTS OF CRAZY STUFF TO theNumber HERE. return theNumber; public class DoSomethingElse If the logic is similar in the classes and you can identify what changes, you can encapsulate it. This would be our Template: public abstract class DoSometingBase protected abstract int GetTheNumber(); int theNumber = GetTheNumber(); return m_number; Implementing a Data Access Layer in C#

A Data Access Layer is an important layer in the architecture of any software.

Implementing a Data Access Layer in C#

This layer is responsible for communicating with the underlying database. Making this layer provider independent can ensure multi database support with ease. This article discusses implementation of a provider independent Data Access Layer in C#. Interfaces + Factory pattern = Decoupled architecture. Interfaces + Factory pattern = Decoupled architecture Introduction In this tutorial we will try to understand how we can use interfaces and factory pattern to create a truly decoupled architecture framework.

Interfaces + Factory pattern = Decoupled architecture

In this sample we will take up a simple three tier architecture and apply interfaces and factory pattern to see how we can transform the three tier in to a truly decoupled architecture. For past some days I have been writing and recording videos in design patterns, UML, FPA, Enterprise blocks and lot you can watch the videos at You can download my 400 .NET FAQ EBook from Everyone's favorite the three tier architecture Ok, everyone know what's a three tier architecture is.

If we analyze these three sections one of the important points to be noted is that business validations are highly volatile. The second volatile section is the client. Data access is the least volatile of all. Controlling change ripples Below is a business class called as 'clsInvoiceHeader'. Practical Entity Framework for C#: Explore Entity Framework.

Entity Framework Support. The latest ADO.NET evolution focuses on raising the level of abstraction from the logical (relational) level to the conceptual (entity) level.

Entity Framework Support

For this purpose Microsoft introduces the Entity Framework, designed to simplify data - object conversion and embed data access queries into program code. The Devart dotConnect product line supports the ADO.NET Entity Framework for Oracle, MySQL, PostgreSQL, SQLite, DB2, and Salesforce. dotConnect data providers support all the Entity Framework versions - Entity Framework v1, v4, v5, and v6. Entity Framework features: Support for LINQ to Entities and Entity SQL dotConnect data providers offer the most complete support for LINQ to Entities and Entity SQL. Database-specific features: Wide Support for Database Types dotConnect product line offers wide support for database types including Oracle CURSORs and SDO_GEOMETRY, MySQL geometry, PostgreSQL PostGIS geometry and geography data types.

Wide Support for Stored Procedures Full-Text Search Suport. NHibernate Forge. Devart Product. Click on a price to enter the secure purchasing site and begin your order.

Devart Product

As soon as we have been notified that your order has been processed, we will send you an email with your license number and further download information. dotConnect for Oracle can be registered under three types of licenses. You can get Single License for one developer, Team License for up to four developers, and Site License for an unlimited number of developers within a single company at one physical address. If you have other questions, please read our FAQ on License Agreement. Initial purchases of any dotConnect for Oracle Edition and version upgrades include an annual dotConnect for Oracle Subscription. To view an editions comparison chart, visit the Editions page. Should you have any quesions regarding the ordering process, please refer to the Ordering FAQs.

Our online ordering system is powered by share-it! NHibernate. Feature summary[edit] NHibernate's primary feature is mapping from .NET classes to database tables (and from CLR data types to SQL data types).

NHibernate

NHibernate also provides data query and retrieval facilities. NHibernate generates the SQL commands and relieves the developer from manual data set handling and object conversion, keeping the application portable to most SQL databases, with database portability delivered at very little performance overhead. NHibernate provides transparent persistence for Plain Old CLR Objects (POCOs). The only strict requirement for a persistent class is a no-argument constructor, which does not have to be public. History[edit] Version 1.0 mirrored the feature set of Hibernate 2.1, as well as a number of features from Hibernate 3. NHibernate 1.2.1, released in November 2007, introduced many more features from Hibernate 3 and support for .NET 2.0, stored procedures, generics, and nullable types.

Best way to improve performance of NHibernate?