How to encapsulate access to a database?

I am developing a transactional application in .NET and want to get some information on how to properly encapsulate access to the database so that:

  • I do not have connection strings. over the place
  • Multiple calls to the same procedure from different functions
  • or WORSE, several stored procedures differing in a single column

I am interested to know if it is useful to use ORM, for example NHibernate, as this can simply add another level of complexity to a rapidly changing data model, and artifacts need to be created in a short time.

I'm more interested in methods or patterns other than ORM packages.

+3
source share
4 answers

There are at least two widely accepted design patterns used to encapsulate data access:

  • repository (DDD)
  • DAO (data access object)

For completeness, I offer you the following books:

+1
source

If this seems to be an important project and DAL is a major risk factor, ask someone who has done this before. You are absolutely right that there are too many ways to get off the rails, trying to achieve this for the first time without solid experience.

There are many templates for this, but I would look for someone who has a simple set of well-defined templates that make them completely comfortable.

+1

Java, jdbc, s'n not.NET, , Spring .

-1

Source: https://habr.com/ru/post/1709545/


All Articles