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
0
votes
1 answer

How can you generically map a DbDataReader to a Castle.Windsor resolved type?

This is confusing me, so this question will probably be confusing. I have a an application that uses implementations of an IJob interface to accomplish different tasks. public interface IJob { int Id { get; set; } string Name { get; set; } …
scottm
  • 27,829
  • 22
  • 107
  • 159
0
votes
6 answers

Does a "thin data access layer" mainly imply writing SQL by hand?

When you say "thin data access layer", does this mainly mean you are talking about writing your SQL manually as opposed to relying on an ORM tool to generate it for you?
pepper
  • 3
  • 1
0
votes
1 answer

business service calls multiple methods on the Data Access Layer each opening a connection

I am doing this pseudo-code in my unitservice which is calling 2 methods of the UnitDataProvider class. var units = dataProvider.GetChildrenUnits(parentId); unit.HierarchyIndex = units.Where( u => u.TemplateId == unit.TemplateId && u.ParentId ==…
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
0
votes
2 answers

when to set up a web service versus just querying the database

we have several sites for several different clients, each with several different databases. Some of the databases are at client location, some are on our site. I have been tasked with creating a few sharepoint sites that will display information…
jeff
0
votes
3 answers

Implementing Next/Previous with LINQ to SQL

I have the code below in an attempt to allow the user to "Step Through" the Case Notes in the DB by clicking Next or Previous on the WinForm. It will grab the First Case Note only. What am I doing wrong? There has been numerous edits to this post,…
Refracted Paladin
  • 12,096
  • 33
  • 123
  • 233
0
votes
2 answers

Passing POCOs or EF objects to the Web project?

Say I have a Visual studio solution with two projects: one web project, and one data project. Does it really matter whether I pass the EF object from the data project to the web project, or do I need to explicitly define POCOs in the data project to…
Cody
  • 8,686
  • 18
  • 71
  • 126
0
votes
1 answer

How to access DataSet From BLL in c#

I'm sorry for the question, but I'm new with the BLL :( I have my DAL with a dsUsers.xsd created. Now I'm trying to develop the BLL for UserBLL, I realized that in some examples on the web, they make reference to the table adapters like this: using…
Somebody
  • 2,667
  • 14
  • 60
  • 100
0
votes
1 answer

context instancing in entity framework class library used by different kinds of applications

I am using the latest Entity Framework with a code-first approach to create a data access assembly that can then be used by multiple projects. Many threads on stackoverflow seem to suggest creating one context per request in an MVC web app. But I…
user1151923
  • 1,853
  • 6
  • 28
  • 44
0
votes
1 answer

List to Database

I might be way off here, and this question probably bordering subjective, but here goes anyway. Currently I use IList to cache information from the database in memory so I can use LINQ to query information from them. I have a ORM'ish layer I've…
Simon
  • 9,197
  • 13
  • 72
  • 115
0
votes
1 answer

retrieve single cell value from strongly typed data column using dataadapter

I have a data adapter with a method that that takes a variable and returns all entries that matches the variable: e.g. TableAdaptor ta = new TableAdaptor(); DataTable dt = ta.GetUserByUserID(UserID); But I can't for the life of me figure out how…
Tony
  • 1,839
  • 10
  • 27
  • 48
0
votes
1 answer

mvc3 and linq to sql architecture

I am building an MVC3 application and I am using Linq to sql for my DAL. My DAL is called MyDataReader and handles creating/initializing datacontext, plus it defines all the methods that retrieve data from the database. All the methods are instance…
newcoder
  • 25
  • 2
  • 13
0
votes
2 answers

Separate data from UI layer?

I want to completely separate data layer from the UI Layer. Here is my example, I have some customers that require different data for the same report and I don't wan the UI to touch the Data Layer, so I am assuming I need some "thing" in between…
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
0
votes
1 answer

Duplicate a record and its references in web2py

In my web2py application I have a requirement to duplicate a record and all its references. For example one user has a product (sponserid is the user). and this product has so many features stored in other tables (reference to product id). And my…
Pradeeshnarayan
  • 1,235
  • 10
  • 21
0
votes
1 answer

Writing DB data to a binary file

I'm dealing with a large scale DB that grows every day. Pulling the required data from this DB involves some joins and due to the large amount of data it takes too long. A friend suggested the following: Once a day pull all the required data from…
forhas
  • 11,551
  • 21
  • 77
  • 111
0
votes
1 answer

Problem: Sorting for GridView/ObjectDataSource changes depending on page

I have a GridView tied to an ObjectDataSource using paging. The paging works fine, except that the sort order changes depending on which page of the results is being viewed. This causes items to reappear on subsequent pages among other issues. I…
ATL_DEV
  • 9,256
  • 11
  • 60
  • 102