views:

423

answers:

14

What particular method/application are you using to communicate between your application and a database? Custom code with stored procedures? SubSonic? nHibernate? Entity Framework? LINQ?

+2  A: 

I primarily use Microsoft Enterprise Library Data Access Block to access stored procedures in MS SQL Server databases.

Michael Haren
A: 

At work our code base is C++ and Perl and we talk to a MySQL database. For our interface we have some fairly thin custom classes wrapped around the basic MySQL client libraries for our C++ code and the DBI module for our Perl scripts.

dagorym
A: 

SubSonic and LINQ to SQL, hopefully one day soon LINQ to SubSonic though!

Kevin Sheffield
A: 

I primarily use NHibernate, both at work and on my freetime projects. This started as an attempt to break out of the norm at work to use ADO.NET datareaders/datasets and we now have a few projects using Hibernate/NHibernate.

Geir-Tore Lindsve
A: 

SqlHelper class from the older version of the MS Enterprise App Blocks. It is far from perfect, but hard to beat its simplicity for simple CRUD apps.

JasonS
A: 

We're using IdeaBlade on our projects. I've found it to be pretty easy to use.

csjohnst
A: 

MS SQL Stored Procedures.

EndangeredMassa
A: 

I usually create a DataTier with LiNQ.
It consist of repositories that implement composite interfaces, so I have total flexibility on how to use them.

IPersonRepository : IReadRepository<Person>, ICreateRepository<Person>, IUpdateRepository<Person> //and so on..

They are mostly domain object centric, so they emit domain objects and take care of all the mapping logic themselves.
They might also create some list dictionaries, f.ex a dictionary consisting of the id and name of a person, so I don't have to pull up too much from the db to display a drop down list.
Although sometimes, for smaller projects, I just use Attribute base mapping without a .dbml.

I feel that this approach gives a very clean application model, because all the messy data centric logic is hidden in the DataTier. The Business-/ServiceTier is pure business :)

Lars Mæhlum
Cool! have you posted your code anywhere?
CVertex
No, but I most definitely will one day. :) Maybe a project structure template or something.
Lars Mæhlum
A: 
  • SQL Server
  • All stored procedures
  • Handrolled polymorphic entity framework that I reuse from project to project to handle the Sproc Resultset -> Object mapping.

I guess that makes me oldschool.

FlySwat
+2  A: 

I've been using NHibernate for the last year or so, and it's proved to be a really quick way of getting basic CRUD (almost) for free.

If this is something you're looking to get into, I can recommend Billy McCafferty's NHibernate best practices article on CodeProject:

http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx

This has proven to be a great scalable and flexible solution and makes it easy to achieve a clear separation of the DAL from the other layers.

Joe Steele
A: 

MVC framework where model's has datasource classes with the actual database language, the developer in most cases uses save, saveField, delete, find etc methods and the framework translates this to sql queries. This is not only safer and easier, it is also very convenient in that the code is datasource indepenedent, ie you can change database server and keep the code.

Alexander Morland
A: 

I've started with Hibernate on Java project at my workplace, and then realized that there exist the .Net port (NHibernate) and used it again in a .Net project. I've also came across the article that joesteele mentions, and used it as a base for my projects with some minor modifications when needed, mostly when needed to target transaction beginning and ending manually.

The same practice and library that can be applied to both Java and C# platforms, targeting the Windows, or Linux as application platforms, makes development on different platforms easier than needing to learn different frameworks.

Although i'm planning to exmine the Subsonic, iBatis and LINQ, for now Hibernate and NHibernate seem like the right tool for the job while i have to target both Windows and Linux platforms.

zappan
+1  A: 

I used Hibernate in my previous job to connect to both MySql and Sql Server but I have since switched over to .NET so currently I work with LINQ and I really enjoy it.

Mike Fielden
A: 

We've got an oracle back end with something like 500 stored procedures where applications run directly against the data.

I started building a custom or-mapped domain model that I've been integrating but I did it wrong initially and now am stuck dealing with that headache as well...ugh

George Mauer