data-access-layer

Repository pattern with lazying loading using POCO

Hi, I'm in the process of starting a new project and creating the business objects and data access etc. I'm just using plain old clr objects rather than any orms. I've created two class libraries: 1) Business Objects - holds all my business objects, all this objects are light weight with only properties and business rules. 2) Repository...

Databing literal controls from BLL

It seems like such an easy thing to do, but im stumped. I have a DAL & BLL. Within my BLL i have a the following function returning one video by its id Public Function GetTrainingVideoById(ByVal id As Integer) As TPSupportDataSet.TraningVideosDataTable Return Adapter.KB_TRAININGVIDEO_S_ID(id) End Function Now on my aspx page i ha...

LINQ 2 SQL: Partial Classes

I need to set the ConnectionString for my DataContext's based on an AppSetting. I am trying to do this by creating a Partial Class for each DataContext. The below is what I have so far and I am wondering if I am overlooking something? Specifically, am I dealing with my DataContext's correctly(disposing, staleness, etc)? Doing it th...

Returning a DTO vs DataTable from the DAL

Is it fine to have the DAL return a DTO type from the Domain model vs just returning a DataTable? Isn't is looser to have your DAL functions return DataTables/DataSets and have your BLL map the data to business objects? ...

Recommendations, Asp.Net ObjectDataSource bind result of webservice call

I need recommendations on how to solve / structure a solution to the following problem. In an asp.net web application i'll have to visualise results returned from a web service call. Im planning to use a repeater server control and bind this with an objectdatasource. The service returns a result of the form: public class SearchResul...

Is a Multi-DAL Approach the way to go here?

Working on the data access / model layer in this little MVC2 project and trying to think things out to future projects. I have a database with some basic tables and I have classes in the model layer that represent them. I obviously need something to connect the two. The easiest is to provide some sort of 'provider' that can run operatio...

How to use DAOs with hibernate/jpa?

Assuming the DAO structure and component interaction described below, how should DAOs be used with persistence layers like hibernate and toplink? What methods should/shouldn't they contain? Would it be bad practice to move the code from the DAO directly to the service? For example, let's say that for every model we have a DAO (that ...

Improving the performance of an nHibernate Data Access Layer.

I am working on improving the performance of DataAccess Layer of an existing Asp.Net Web Application. The scenerios are. Its a web based application in Asp.Net. DataAccess layer is built using NHibernate 1.2 and exposed as WCF Service. The Entity class is marked with DataContract. Lazy loading is not used and because of the eager-fetch...

Business Objects/Custom Classes DAL Design

I need some advice on how to handle this scenario. My application has many tables and custom classes mapped to those tables. Let's use the following as an example (pseudo-code): Public Class Country Name As String Language As String Capital As String President As String Public Class State Name As String Capital As String Country As S...

A good(elegant) way to retrieve records with counts.

Context: ASP.NET MVC 2.0, C#, SQL Server 2007, IIS7 I have 'scheduledMeetings' table in the database. There is a one-to-many relationship: scheduledMeeting -> meetingRegistration So that you could have 10 people registered for a meeting. meetingRegistration has fields Name, and Gender (for example). I have a "calendar view" on my sit...

Data Access Layer - static list objects and caching

Hello, i am devloping a site using .net MVC i have a data access layer which basically consists of static list objects that are created from data within my database. The method that rebuilds this data first clears all the list objects. Once they are empty it then add the data. Here is an example of one of the lists im using. its a met...

DAL, Session, Cache architecture

I'm attempting to create Data Access Layer for my web application. Currently, all datatables are stored in the session. When I am finished the DAL will populate and return datatables. Is it a good idea to store the returned datatables in the session? A distributed/shared cache? Or just ping the database each time? Note: generally th...

Is a base class with shared fields and functions good design

I've got a BaseDataClass with shared fields and functions Protected Shared dbase as SqlDatabase Protected Shared dbCommand as DBCommand ... //also have a sync object used by the derived classes for Synclock'ing Protected Shared ReadOnly syncObj As Object = New Object() Protected Shared Sub Init() //initializes...

.net, C# Interface between Business Logic and DAL

I'm working on a small application from scratch and using it to try to teach myself architecture and design concepts. It's a .NET 3.5, WPF application, and I'm using Sql Compact Edition as my data store. I'm working on the business logic layer, and have just now begun to write the DAL. I'm just using SqlCeComamnds to send over simple ...

Database testing in python, postgresql

How do you unit test your python DAL that is using postgresql. In sqlite you could create in-memory database for every test but this cannot be done for postgresql. I want a library that could be used to setup a database and clean it once the test is done. I am using Sqlalchemy as my ORM. ...

Using Multiple databases with a common code

Hello, I just want to be able to store and access data from ACCESS,SQLSERVER,SQLCE,SQLLITE based on the users choice. Is there a SINGLE library that can help me do this job in c#? I would like to simply change the connection string and not the code. Is there any way for this? Thanks. ...

C# Design How to Elegantly wrap a DAL class

I have an application which uses MyGeneration's dOODads ORM to generate it's Data Access Layer. dOODad works by generating a persistance class for each table in the database. It works like so: // Load and Save Employees emps = new Employees(); if(emps.LoadByPrimaryKey(42)) { emps.LastName = "Just Got Married"; emps.Sav...

Under what circumstances would a LINQ-to-SQL Entity "lose" a changed field?

I'm going nuts over what should be a very simple situation. In an ASP.NET MVC 2 app (not that I think this matters), I have an edit action which takes a very small entity and makes a few changes. The key portion (outside of error handling/security) looks like this: Todo t = Repository.GetTodoByID(todoID); UpdateModel(t); Repository.Sav...

ASP.NET MVC2 Data Access Layer

For a small/medium sized project I'm trying to figure out what is the 'ideal' way to have a domain layer and data access layer. My opinions on coupling tend to be more towards the view that the domain models should not be tightly coupled with the database layer, in other words the data access layer shouldn't actually know anything about ...

Starting to construct a data access layer. Things to consider?

Our organisation uses inline sql. We have been tasked with providing a suitable data access layer and are weighing up the pro's and cons of which way to go... Datasets ADO.net Linq Entity framework Subsonic Other? Some tutorials and articles I have been using for reference: http://www.asp.net/(S(pdfrohu0ajmwt445fanvj2r3))/learn/dat...