Should you use a partial class across projects?

后端 未结 8 502
佛祖请我去吃肉
佛祖请我去吃肉 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:25

    While I agree with you Neil when it comes to pre-linq development, I also wish I could be able to do this in order to split up bussiness logic from partial classes generated by Linq2SQL designer. For example:

    Northind.DAL (prj)
    -NorthindDataContext (EntityNamespace set to "Northwind.BLL")
    --Product() (Entity, partial class auto-generated)
    --Category() (Entity, partial class auto-generated)
    --Supplier() (Entity, partial class auto-generated)
    
    Northind.BLL (prj)
    -Product() : IMyCustomEnityInterface, BaseEntity (override OnValidate(), etc)
    -Category() : IMyCustomEnityInterface, BaseEntity (override OnValidate(), etc)
    -Supplier() : IMyCustomEnityInterface, BaseEntity (override OnValidate(), etc)
    

    Unfortunately, we can not do this... actually I'd love to know what the recommended way of splitting up layers/tiers when using LINQ.

提交回复
热议问题