data-access-layer

Are there any gotchas or good reasons not to use autosproc for stored procedure calls?

I've implemented a data access layer that populates generic entities from a datareader using a variation of the third monkey approach (http://www.codeproject.com/KB/database/DynamicMethod_ILGenerator.aspx). This works well, performs well and saves me writing loads of repetetive code for data retrieval. Now I want to add methods that tak...

Sometimes Connected CRUD application DAL

I am working on a Sometimes Connected CRUD application that will be primarily used by teams(2-4) of Social Workers and Nurses to track patient information in the form of a plan. The application is a revisualization of a ASP.Net app that was created before my time. There are approx 200 tables across 4 databases. The Web App version re...

C# static database class?

I have a Database class which contanins the follwing methods: public bool ExecuteUDIQuery(string query) // UDI = Update Delete Insert public bool ExecuteSelectQuery(string query) public bool ExecuteSP(string sp, string[,] parms) public int ExecuteSPReturnValue(string sp, string[,] parms) The results of the methods are stored in priva...

Best "pattern" for Data Access Layer to Business Object

I'm trying to figure out the cleanest way to do this. Currently I have a customer object: public class Customer { public int Id {get;set;} public string name {get;set;} public List<Email> emailCollection {get;set} public Customer(int id) { this.emailCollection = getEmails(id); } } Then my Email object ...

Data Access Layer Static or Instance based?

My current application is using an instance based data access layer. I instantiate the layer with the connection string. I then call a method that will do some sort of command. For example there is a method that will fill a dataset. Basically, I pass the stored procedure and any SQL parameters and get back a dataset. Is it better to have...

Data Access Layer newbie

Newbie to .NET data apps here, coming from a Visual Foxpro background. I'm planning on an ASP.NET and/or Silverlight UI, and maybe some WPF client stuff too on our LAN too, so I want to craft a data access layer that can support all these front ends. My data will be in SQL server. I have already made a test run of pushing the data from...

One complex query vs Multiple simple queries

What is actually better? Having classes with complex queries responsible to load for instance nested objects? Or classes with simple queries responsible to load simple objects? With complex queries you have to go less to database but the class will have more responsibility. Or simple queries where you will need to go more to database. ...

Passing comma delimited list as parameter to IN clause for db2 query using designer in visual studio 2008

I want to pass a comma delemited list of values as a parameter to a query I'm building using the designer in Visual Studio 2008 based on some strongly typed DAL tutorials I was going through. The query is going against a DB2 database. Here's what I want to do: select * from prices where customer in(?) It works fine win I pass in 1234...

Which Data Acccess layer is the recommended today for ASP.net?

Good day! I'm currently building a small website where I write down problems that arise and answers to them for others to see. Currently I'm using a DAL much like the one described here. Now I have been looking at other models, and in particular linq based models using Linq2SQL and the ADO.net Entries framework. I realize I'm moving the...

update DB from layered architecture: best approach?

I'v e built a basic DAL which can retrieve data and a businesslayer with several objects using this DAL. Once I mapped the data into the business objects and done something with it, I also want to write the data back to the database. Some of the business objects have a lot of properties, so passing every value of a business object as par...

Enterprise library caching parameters on stored procs?

I'm trying to standardise some data access code with my colleagues. One of the aforementioned colleagues asserts that the EntLib Data Access Block trys to cache parameters on stored proc calls. I've had a look in reflector and there is some evidence that it could be caching them. But I don't think it does in the following situation. ...

How to update and insert with Data Access Application Block and OLEDB

Hello, I can't seem to find any good documentation on this. I want to use the Data Access Application Block with some dbf files and an access database. How do you use the AddInParameter method properly? If you have to use the "?" what is entered into the name parameter of that method? Someone else said that you can use the named paramet...

What to return from the DAL to BLL

Hello Everyone, 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 Button1_Click() { IBook book = BookManager.GetBook(txtID.Text); } Here is my BL...

Passing enviroment variables to Data Access Layer

Every stored procedure we write has to have clientip, serverip, windows username, etc passed on to it. The question is how do I efficiently pass these to DAL? ...

Simple Elegant pattern to separate Data Access, Business logic and presentation

I need a simple pattern to do the above. Few things to note: 1) I have a class that I am obliged to use that does the actual data retrieving and it return DataTable 2) I am not concerned with the generic interfaces that support all possible database types, we are sticking with one database type. 3) How do I elegantly trap the error a...

Abstracting Data Access Layer from Business Object

Hi It's nothing new to de-couple the data access code from your business objects, but I'm always on the look-out for the "best way" to achieve something. I have the following classes: Orange - this is my Business Object. OrangeList - this is a List of Oranges. The user would fetch Orange objects from the data store by calling Oran...

Data mapping code or reflection code?

Getting data from a database table to an object in code has always seemed like mundane code. There are two ways I have found to do it: 1) have a code generator that reads a database table and creates the class and controller to map the datafields to the class fields or 2) use reflection to take the database field and find it on the cla...

SubSonic deployment and changing connectionstrings

I used Subsonic to build the DAL for one of my web applications. When I move it from my test server to the production server I change the connectionstring to point to the production datasource but the app still runs against the test DB. Is the connection information stored someplace else in addition to the Web.config? What are the best...

Best Way to Handle SQL Parameters?

This is really a VB.NET/C# question. Ok, so I essentially have a database layer that is totally isolated from any business logic. This means that whenever I get ready to commit some business data to a database, I have to pass all of the business properties into the data method's parameter. For example: Public Function Commit(foo as o...

What should my data access layer look like with a parent-child relationship?

I'm writing my first NHibernate application, but I guess this question applies to any ORM framework. My application is a simple bug tracker (devs all understand the problem domain, right?), and I'm wondering how best to model the Project/Ticket relationship in the DAL. A Project has multiple Tickets; a Ticket must be owned by a Project. ...