Data Access Layer design patterns

后端 未结 7 1258
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 06:38

I have to design a Data Access Layer with .NET that probably will use more than one database management system (Mysql and Sql Server) with the same relational design.

<
7条回答
  •  -上瘾入骨i
    2020-11-29 07:38

    In general, I second John Nolan's recommendation of Patterns of Enterprise Application Architecture.

    More specifically, I would always recommend that you hide your Data Access Layer behind an interface and use Dependency Injection to inject a particular Data Access Component into your Domain Logic at run-time.

    You can use a Dependency Injection Container or do it manually.

    On the technology side I would recommend Microsoft's Entity Framework, since your data access needs seem to be constrained to relational databases. The Entity Framework is Microsoft's official OR/M and it has providers for many different RDBMSs, as well as LINQ support.

提交回复
热议问题