data-access-layer

How to handle connections in data access layer ( .net )

Hi I am writing a data access layer. I am confused about managing connections in the system. I know that .net uses connection pooling. But I do not want to open and close database connections in all dml operations or in all sql query's. How can I handle this? Where and when ( maybe in global asax which uses data access layer or in the da...

Best designs for breaking down business logic and data layer when they seem to overlap?

I'm building a MVC web application (using the Spring MVC framework), and I'm a little stumped on the best way to design a particular area. The application has to interact with a series of web services which are not really all that greatly designed, and don't offer much abstraction in and of themselves - basically there is a web service ...

Polymorphic Domain Objects Based On Data Mapper

I have a basic domain object, say like Person or Campaign or Event that is represented by a single table in the database. However, I also have more complicated versions of these objects say like a PersonCampaign or PersonEvent or even CampaignEvent that could theoretically extend one of the base objects. However, for a number of reasons...

What's the difference between DAO and Data Mapper

Is there a difference between the DAO pattern and the Data Mapper pattern? Is DAO just one of doing Data Mapper? ...

Best way to pass Entity Framework entity collections from the DAL to the Business Layer?

I have a DAL that makes calls to my Entity Framework Model. The calls return things like IOrderedQueryable and IQueryable objects. Should I convert them to something more universal in my DAL, such as List? But I assume that if I don't need to enumerate through the entire collection, this could be wasteful... So whats the best approac...

Why does an Entity Framework Connection require a metadata property?

I switched my DAL from using LINQ over to Entity Framework. Because my application connects to different databases depending on the current user, I need to dynamically create the DataContext at run time and pass in the appropriate connection string. However, when I tried to programatically create an Entity Framework connection using my...

Do any OR Mappers provide Asynchronous Methods?

Do any .Net O/R (object/Relational) Mappers provide Asynchronous methods out of the box? I don't want to have to write the boiler plate for the asynchronous method if possible I have rolled my own DAL with Asynchronous methods using the CCR framework. The CCR basically demands that I don't block any of it's threads waiting for IO respo...

File Management: Handled by the Data Access Layer of Business Layer???

So, I am working on this web based app following the Repository model, a wannabe DDD dork, using StructureMap.... blah, blah, blah... One aspect of the application allows users to upload and manage files. Where, what layer, should be responsible for managing the saving/ deleting of these user files? The Business Layer, or the Data Ac...

What ORM to Run: telerik Open Access VS Subsonic VS linq to sql VS Active Record

We are looking into using an ORM and I wanted some opinions/comparisons The basic criteria we have for an ORM is: Easy to use/configure(short learning curve), flexible, the ability to abstract it away, easy to maintain Here is a list of what ORM we are looking at and what our initial impressions are Open Access - seems really ...

Swapping out databases?

It seems like the goal of a lot of ORM tools and custom data access layers (DAO pattern, etc.) is to abstract the database to the point where you could supposedly swap out the entire database system with minimal work. Following the common DAL patterns is usually a good idea in code, but it seems like it would never be minimal work to sw...

Where do you put SQL Statements in your c# projects?

I will likely be responsible for porting a vb6 application to c#. This application is a windows app that interacts with an access db. The data access is encapsulated in basic business objects. One class for one table basically. The existing vb6 business objects read and write to the DB via DAO. I have written DALs and ORMs a few times be...

WCF OperationContract and Nhibernate ICriteria

We are trying to create a cool API using WCF and ICriteria, for example: [ServiceContract] public class ProductService { [OperationContract] public List<Product> Get() [OperationContract] public List<Product> GetByCriteria(Criteria criteria) } We are thinking of using the DetachedCriteria so anyone can send it and we connect this to...

Where is the line between DAL and ORM?

The terms are often thrown around interchangeably, and there's clearly considerable overlap, but just as often it seems implied that people see something strongly implied by saying that a system is an ORM that isn't implied by it being a DAL. What is that? What, if any, are the key points that differentiate these types of system? For ...

DAL design question

I need to design a Data access layer DAL .Net Enterprise library version 3.5 Data access application block (DAAB) In my application,I've various logical modules like Registration, billing, order management, user management,etc Am using C# business entities to map the module objects to database tables and then return the List collection ...

Extension Methods for Indexers, would they be good ?

Extension Methods for Indexers, would they be good ? I was playing around with some code that re-hydrates POCO's. The code iterates around rows returned from a SqlDataReader and and uses reflection to assign properties from column values. Down my call stack I had a code a line like this :- poco.Set(“Surname”, “Smith”); // uses exten...

Pros and Cons of using Singleton Pattern in DAL

I have asked to use singleton pattern implemented DAL, but I think its difficult to pool the connections,use transactions..etc I would like to know the pros and cons and also would like to know the best way to pool the connections as there can be more than 500 concurrent users for the site I am developing. DB Server is Oracle 10g. DAL...

DAL design

I'm using .Net enterprise library data access application block for my Data Access layer design. In my Category DAL class, I've methods like : GetProductsInCategory(int CatId), GetAllProducts, GetCategories, etc. My question is: where do i put this line of code ? DatabaseFactory.CreateDatabase("MyDB"); shall i put it in every met...

LINQ2SQL or Entity Framework or Enterprise Library??

with LINQ2SQL, Entity Framework in the market, does it make sense to use Enterprise Library data access application block to design Data Access Layer(DAL)? thanks. ...

Orm tool not allowed: What do you do?

Let's say you're in an IT shop that allows no ORM tool of any kind. They don't want to buy one, and neither can you use an open source solution. What would you do? Give up on a real domain model and work table-centric? Craft own DAL? ...

System.Data.DbType Vs System.Data.SqlType

Am using enterprise library data access application block... is there any performance impact of using System.Data.DbType Vs System.Data.SqlType? And also, would like to know performance impact for the statement: DatabaseFactory.CreateDatabase("MyDB") Vs new SqlDatabase(myConnectionString); Thanks. ...