I am going to create a database layer to expose a set of functions that will provide reading and writing to our database. I have many questions related to this, and I want someone to advise
How can I handle database exceptions (e.g. timeout exceptions) or leave the dll client to handle them
The dll will not be thread safe, so should I use one connection for the dll instance? as it improves productivity.
Are there general rules for developing a class library?
I am using C # vs2008 and SQL2008
1: ; , , , , ( , )
2: "" , ; . , , ( , ), , .. ( )
3: , ; ORM, LINQ-to-SQL, Entity Framework, NHibernate ..
.
Customer GetCustomer(int id) { using(var conn = CreateConnection()) { conn.Open(); // etc } }
, , , , , . , , , , ?
, db, , , , , , , . , .
Linq to SQL, , -, ADO.net ORM .