简体   繁体   中英

What is the most elegant C# .NET Data Access Layer design?

I would like to konw what is considered the most elegant C# .NET method to produce a Data Access Layer?

I am using MyGeneration DooDads . Is this an elegant solution?

Is it still acceptable to use the CRUD Stored Procedures + DAL Library for data access with .NET Entity Framework and NHibernate ORM tools?

You can try to use domain model with ORM (Linq or Nhibernate). Visual Studio has a good support for Linq, it is easy to configure and use. All data access methods are encapsulated in the domain objects (data table objects) and all the query result is strong typed.

There is no answer to this question; everybody has different opinions.

Personally I like ORMs for simple home projects but wouldn't go near one in an application I actually have to support, and much prefer to use stored procedures to give the database a well defined interface that is abstracted from the storage mechanism.

Many people disagree with this point of view. Heck, even I'll probably disagree with it in a few years time. But it doesn't really matter what I think or what they think, if you're happy with what you're doing and find it efficient to code and easy to support, then it's elegant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM