Questions tagged [data-access-layer]

Data access layer is a layer of a computer program which provides simplified access to data stored in persistent storage of some kind, such as an entity-relational database.

A data access layer (DAL) in computer software, is a layer of a computer program which provides simplified access to data stored in persistent storage of some kind, such as an entity-relational database.

For example, the DAL might return a reference to an object (in terms of object-oriented programming) complete with its attributes instead of a row of fields from a database table. This allows the client (or user) modules to be created with a higher level of abstraction. This kind of model could be implemented by creating a class of data access methods that directly reference a corresponding set of database stored procedures. Another implementation could potentially retrieve or write records to or from a file system. The DAL hides this complexity of the underlying data store from the external world.

For example, instead of using commands such as insert, delete, and update to access a specific table in a database, a class and a few stored procedures could be created in the database. The procedures would be called from a method inside the class, which would return an object containing the requested values. Or, the insert, delete and update commands could be executed within simple functions like registeruser or loginuser stored within the data access layer.

Also, business logic methods from an application can be mapped to the Data Access Layer. So, for example, instead of making a query into a database to fetch all users from several tables the application can call a single method from a DAL which abstracts those database calls.

1287 questions
11
votes
2 answers

C# Handle on SQL Server Message Output

When executing scripts in SQL Server Management Studio, messages are often generated that display in the message window. For example when running a backup of a database: 10 percent processed. 20 percent processed. Etc... Processed 1722608 pages…
bopapa_1979
  • 8,949
  • 10
  • 51
  • 76
11
votes
6 answers

In-memory DBMS's for unit testing

I am looking for satisfactory options for unit testing my .NET DAL classes; since they're DAL classes, they access the database directly using ADO.NET. Presently I use an instance of a MSSQL database for the testing, but was wondering what faster…
Eric Smith
  • 5,262
  • 2
  • 33
  • 49
11
votes
2 answers

What are alternatives to standard ORM in a data access layer?

We're all familiar with basic ORM with relational databases: an object corresponds to a row and an attribute in that object to a column, though many ORMs add a lot of bells and whistles. I'm wondering what other alternatives there are (besides raw…
swampsjohn
  • 6,826
  • 7
  • 37
  • 42
11
votes
5 answers

.NET Object persistence options

I have a question that I just don't feel like I've found a satisfactory answer for, either that or I've not been looking in the right place. Our system was originally built using .NET 1.1 (however the projects all now support 3.5) and all entities…
MrEdmundo
  • 5,105
  • 13
  • 46
  • 58
10
votes
7 answers

What to return from the DAL to BLL

I currently have an application which consists of: User Interface (web page) BLL (Manager & Domain Objects) DAL (DataAccess class for each of my Domain Objects). I use the following in the UI to search for a domain object. protect sub…
AlteredConcept
  • 2,602
  • 7
  • 32
  • 36
10
votes
4 answers

Is DTO plus UnitOfWork pattern a good approach to design a DAL for a web application?

I'm implementing a DAL using entity framework. On our application, we have three layers (DAL, business layer and presentation). This is a web app. When we began implementing the DAL, our team thought that DAL should have classes whose methods…
JPCF
  • 2,232
  • 5
  • 28
  • 50
10
votes
5 answers

How should the Data Access Layer be structured?

I initially designed my system following the s# architecture example outlined in this codeproject article (Unfortunately, I am not using NHibernate). The basic idea is that for each domain object that would need to communicate with the persistence…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
9
votes
3 answers

How do I design a Data Access Layer appropriately?

I have the following Data Access Layer (DAL). I was wondering if it's set up correctly, or if I need to improve it? public class User { } //Persistence methods static class UserDataAccess { UsersDAL udal = // Choose SQL or FileSystem DAL…
Munish Goyal
  • 1,379
  • 4
  • 27
  • 49
9
votes
2 answers

DAL and BLL in .NET

There is this DAL/BLL design suggestion by Microsoft for ASP.NET (2.0) apps. I know some of the alternatives and I've read related questions here on SO. However I wonder if this proposed solution is worth implementing nowadays, is there a specific…
driAn
  • 3,245
  • 4
  • 41
  • 57
9
votes
10 answers

Would you use LINQ to SQL for new projects?

I've been investigating what data layer to use for a new web-based project I'm designing and I'm very keen to look at incorporating LINQ to SQL. Its apparent simplicity, flexibility and designer support really appeals and the implicit tie-in to SQL…
Dave R.
  • 7,206
  • 3
  • 30
  • 52
9
votes
2 answers

DAL, Model Layer, EF code-first and business logic, how do they fit together?

Bit per bit, I am undestanding and becoming more proficient with ASP.NET MVC4. However I'm still failing to be clear in my mind concerning this very important point. Let us say that I have a model : public class WorkPaper { public int…
tobiak777
  • 3,175
  • 1
  • 32
  • 44
9
votes
1 answer

How do I reference the Sqlite db file in the App_Data folder for my ASP.NET Web Application?

I'm currently storing my sqlite db file in the App_Data folder as per ASP.NET best pattern and practices. Currently I'm using the following in the webconfig:
mirezus
  • 13,892
  • 11
  • 37
  • 42
8
votes
2 answers

Entity Framework - layered design - Where to put connectionstring?

I am using a layered architecture with the Entity Framework as my datalayer with a bunch of repositories on top which contain the Linq-To-Entities queries. The data layer is one project, next to that I have a Services layer and the interface, which…
Peter
  • 14,221
  • 15
  • 70
  • 110
8
votes
5 answers

Presentation, Business and Data Layer

I just started programming in C# and was reading about dividing your application / website into the three different layers was the best practice but I am having a hard time understanding exactly how. Im working on a pet project to lean more about C#…
Jon H
  • 273
  • 2
  • 5
  • 14
8
votes
2 answers

Nhibernate: Who is responsible of transaction management in a non web application

Well in a web application a unit of work is responsible for the transaction management. But what about a windows application? As far as I know the repository is the connector between my data access layer and my business layer. It hides all the data…
Rookian
  • 19,841
  • 28
  • 110
  • 180