data-access-layer

Why is Visual Studio's table adapter query not returning the same data as the stored procedure it represents?

I'm using a table adapter in Visual Studio to make a query to a stored procedure in my SQL Server 2005 database. When I make the call via my website application it returns nothing. When I make the same call via SQL Server Manager it returns the expected data. I put a breakpoint on the call to the adapter's getData method and looked at...

ASP.NET Data Access Layer. Is using sqlhelper.cs bad?

I'm about to start a new .net web project. Previsouly for my n-layer web apps i've used the "Microsoft Data Access Application Block" (sqlhelper.cs) for the data access, then an interface class to interface with the object classes. I'm aware this technique is a bit dated and was looking to use something a little more with the times. I'...

How do i save a web form into a MySQL database?

I have an ASP.Net form and i would like to save it into a database any ideas?? ...

Data validation in DAL vs. Business Layer?

Typically I have added data validation, such as checking that an input is within a certain range, in the data models found in my Data Access Layer. Searching the web I've seen that there are two schools of thought on the matter: Adding the validation as part of the Data Access Layer (like I have been doing) Adding the validation as pa...

WCF / Local Data Access Layer

I'm looking for a way to create a data access layer that can either reside on a server and be accessed via WCF services or can reside on the local machine in which case it would just be accessed directly without having to run through iis. Is there a way to abstract this in such a way that changing from the local to the WCF version can be...

What object mapper solution would you recommend for .NET?

There are many ORM solutions out there, so in your experiences what seems to be the best choice? NHibernate or Subsonic, Genome,DLinq, LLBLGen - there seems to be a plethora of options, so pros and cons please people. ...

Testing Data Access Persist Methods

Hi guys Just wondering if anyone has any ideas on how to test ones data access methods. I have found testing retrieval data access methods is much easier because i can just mock out the ExecuteReader and return a populated dataTable.CreateDataReader(). By doing this I can test to see if my object is populating correctly if a result set ...

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 Server is fine. However, it has been announced recently that LINQ to SQL will be taking a...

How can I maintain child objects with LinqToSql over WCF?

I am currently stuck in the design of this solution. The data layer design consists of the following: Recipe (parent high level object) Language Detail (name, description by language) (many) Headers (many) Steps (many) Ingredients (many) Quantities (many) Procedures (many) Notes (many) The challenge that I am having is how to ...

Methods for interacting with a Pervasive SQL database

I'm in the process of developing a web interface to a service business management application that uses a Pervasive SQL database to store information (not my choice, by the way). At the moment, I'm using the official Pervasive SqlClient implementation with a custom set of query generation classes so I can write code like: new SelectQuer...

How to improve data access layer select method Pattern

Lately I find myself writing data access layer select methods where the code all takes this general form: public static DataTable GetSomeData( ... arguments) { string sql = " ... sql string here: often it's just a stored procedure name ... "; DataTable result = new DataTable(); // GetOpenConnection() is a private method i...

Singleton DAL class

Hi, Shouldn't classes in DAL (customerDAL) be singleton? Since my controllers (customerController) exposes "Shared Subs", then on every call, there is no need to create a new DAL object if already existed. Correct? Thanks ...

Loading Business Object Hierarchy with One Database Call

Hi, I would like to know what the best practice for populating a business object hierarchy (parent/child/grandchild) structure is from a single database call. I can think of a couple ways to accomplish it off the top of my head such as: left-joining all the relations in my sql statement then use looping and logic to fill the business ...

Naming conventions for Data Access Layer especially in case of Stored Procedures

Let's assume, we create a stored procedure that is supposed to retrieve customer details and that will be used in some sort of dashboard view. Since there are a couple of other stored procedures relevant for the dashboard as well, one might think about visually grouping the SPs by naming them accordingly: DASH_GetCustomerDetails DASH_....

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 downside you know of? I want to develop DAL/BLL components for company-internal use, to ac...

How to resolve specific circular dependency: DAL & Logging

Some "high risk" data operations need to be logged. In this case, the "high risk" operations are defined as writes to our ERP system. It happens that we are logging those events to our SQL Server database. Pseudo-code: Public Class MyCompany.DAL.ERP { Public void WriteToERP(string msg) { // ... do the write MyCompany.Loggin...

Tranfer data between Object-relational mapper and Data Access Layer using DTO

Does it make sense to transfer data between Object-relational and Data Access Layer using DTO? When would this pattern be useful and when would it be an anti-pattern ...

What would you choose if you could use any .NET DAL technology?

I'm getting back into .NET development after a couple years and it seems that now, especially with LINQ, the way you access your data has changed and become much easier. For instance, in a ASP.NET MVC website, I can: Add Item add LINQ-to-SQL classes drag on database tables onto the LINQ-to-SQL Object Relational Designer, click save ac...

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 options there are---since unit tests need to run as quickly as possible, an in-memory solut...

DAL code generator that can handle mocking and testing, .NET

Hi, I have been testing the nusoft kinetic framework and have been pretty satisfied with it until now. I was going to make some tests with MbUnit and Rhino Mock when I realized that the hole framework was built with static methods and protected classes, making this untestable. My question is, does any one know about a framework like the...