Should you use a partial class across projects?

后端 未结 8 491
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-03 16:42

I have a class library with all my database logic. My DAL/BLL.

I have a few web projects which will use the same database and classes, so I thought it was a good

8条回答
  •  春和景丽
    2020-12-03 17:29

    I see no reason why this scheme would not work:

    Two files contain storage mechanisms (or some other feature). They specify inheritance but contain no business logic:

    • ProductDataAccess.cs
    • ProductWeb.cs

    One file contains the business logic:

    • ProductBusinessLogic.cs

    Now create two projects:

    • WebProject contains ProductWeb.cs and ProductBusinessLogic.cs.
    • DataProject contains ProductDataAccess.cs and ProductBusinessLogic.cs

    Both projects make use of the same business logic.

提交回复
热议问题