data-access-layer

DAL: Application domain POCO classes <-> EDMX generated classes conversion best practice

DAL library exposes interfaces that return and accept application domain POCO classes. DAL uses EF inside with EDMX generated classes. What are the best practices to convert POCO to EDMX? It may be straightforward public PersonInfo GetById(Guid id) { return DataContext.PERS.FirstOrDefault(x => new PersonInfo { Id = x.Pers_id,...

Should a .Net beginner bother with ORM or wait until he gets more experience?

Hello, I am relatively new to .Net and the database side of it in particular. I'm planning to rewrite some legacy VB6 applications here using .Net and C# with Visual Studio 2008. I've studied things like strongly typed datasets, Table Adapters, etc. It works quite well but I find strongly typed datasets to not be perfectly manageable,...

Presentation layer and domain model classes naming conventions

What are the naming conventions you use for application domain model classes and presentation layer classes? Postfixes/Prefixes to distinguish the aim of the class from the first sight: For example information about the person that is returned from DAL can be public class PersonEntity { public Guid Id { get; set; } public SexType...

Basic/Simple Data Access Object (DAO) with Entity Framework 4.0

Hello all, I am trying to put together a simple POC for a n-layer application using EF4 in the data tier. I have looked at numerous examples on the web and it seems to be a common practice to use a DAO or a Repository as the wrapper to an ORM. My understanding that the main difference between the two is that a Repository is more generi...

Object persistence terminology: 'repository' vs. 'store' vs. 'context' vs. 'retriever' vs. (...)

I'm not sure how to name data store classes when designing a program's data access layer (DAL). (By data store class, I mean a class that is responsible to read a persisted object into memory, or to persist an in-memory object.) It seems reasonable to name a data store class according to two things: what kinds of objects it handles; ...

Data Access Layer - LINQ-To-SQL and generics. Can I optimize this?

Hi, We are working on improving our DAL which is written in LINQ that talks to the MS SQL database. Our goal is to achieve good re-usability with as little code as possible. LINQ generated files are making a use of generics and reflection to map LINQ generated classes to the SQL objects (tables and views in our case). Please see the e...

Lookup Tables - Where to put in n-Tier Architecture

I have a few lookup tables that I am in the process of plumbing through my app. These are tables that drive dropdowns on the website. They have no business logic, but they need to get from the database to the UI while following the architecture of the app. The current architecture has a Data Layer, Business Layer, and Presentation Lay...

How to configure subsonic 3.0.0.4 using mysql with Visual Studio 2010?

I downloaded subsonic 3.0.0.4 and i am trying now to configure it to work with mysql and Visual studio 2010. My project is .net 3.5 and i am creating a data access layer class library to use later in a website. I can't figure which files i should add to my project and where to edit. Last step i reached is in this screen shot: ...

Data access layer design pattern

hi, I need to build a data access layer and I am looking for the right design pattern. what I need is: object mapping: it shouldn't be too complicated and not generic. i have a lot of lookup tables and i need to a good way to load them. I don't care about starting time (when the program starts up), what I care is to minimizing the n...

DAL. Modelling data constraints best practice

Data stored in relation database with data constraints (for example maximum string property length). Clients use Data Access Library (DAL) to manage the data in ORM manner (repositories + data domain classes) Where would you personally implement constraints? For example: Data domain classes: class Person { private string _name; publ...

ADO.NET EF as DAL

Hi. I'm developing a project using a layered architecture. I have a DAL in which i'm using Entity Framework, a business logic layer which consumes the objects returned by the DAL and an app layer. I'm not entirely sure i'm thinking this right, so i'll just ask you what you think. My DAL is based on mappers. I have types - mappers - th...

.Net - accessing multiple sql server groups / databases

My program (WCF service programed in C#) has to access multiple sql server groups and the databases within those groups (sql server). It looks like linq 2 sql definitely doesn't support this unless I create multiple dataclasses per database, and it looks like the entity framework is in the same boat. How would you go about setting up yo...

Convert DAL function into Stored Procedures in mysql

Hi I have class for my Data Access Layer that contains a function called GetCitiesByLocation and it looks like this public DataTable GetCitiesByLocation(long pStateID, string pKeyword) { //create database object Database db = DBHelper.CreateDatabase(); //create SELECT sql statement to be executed using string builder /...

Date Created - should this value be set in the BL or DAL?

Date Created a specific example I'm interested in - but there are other bits of data that fall into the same category: data which you'd want to capture about any vaguely important entity. Where best to do this: business logic (BL) or Data Access layer (DAL)? Until now I've relied on SQL Server's getdate() to populate the date created f...

Is it double work creating a data access component and business component?

I am designing my first Layered Application which consists of a Data, Business, and a Presentation layer. My business components (e.g, Business.Components.UserComponent) currently has the following method: public void Create(User entity) { using (DataContext ctx = new DataContext()) { ctx.Users.AddObject(entity); ...

DAL/BLL and Client/Server: Should the client use BLL or DAL objects for presentation? Or maybe another layer (data transfer object?).

Hi, I'm writing a client/server system. The server has a DAL/BLL design. The client is responsible for presenting the data objects and providing dialogs and wizard to allow the user to update these objects (i.e. adding/editing a user). Initially I thought I'll just make the DAL objects have a universal data provider object so they can...

DAL: Is it ok to incapsulate several data sources access in one module?

Application I develop requires several data sources (2 RDBMS and one file storage) to operate. I'm going to incapsulate datasources with DAL library & Business Logic layer. Would you personally create several DAL libraries (each per data source) and cooperate several DAL instances in Business Logic Layer or create monolith DAL library,...

Trying to understand how to abstract my data access layer

I'm writing an application that is used to catalog files, and attribute those files with meta data. A photo album program would be a good comparison to what I'm trying to do. I'm trying to abstract the interface between my program and the file system which stores the files, and the database which stores the meta data for the files. This...

Business Objects and Data Layer

Hello, This site has provided me with many useful answers, however after a hours search I haven't found anything that specifically answers my needs. So here goes... The company I'm working for is in the process of designing a new Business Objects Layer and a Data Access Layer - these will reside in separate assemblies. The problem is...

Which is better, filtering results at db or application?

A simple question. There are cases when I fetch the data and then process it in my BLL. But I realized that the same processing/filtering can be done in my stored procedure and the filtered results returned to BLL. Which is better, processing at DB or processing in BLL? And Why? consider the scenario, I want to check whether a product...