Communication between BLL and DAL

前端 未结 4 1183
孤城傲影
孤城傲影 2021-02-06 08:10

Solution setup:

  • DAL (class library)
  • BLL (class library)
  • Common (class library (some common functionality - enums, logging, exceptions,...))
4条回答
  •  天命终不由人
    2021-02-06 08:36

    Pushing the domain entities into the dal is an option that would remove the crcular dependency, but may not match your intent. This isn't unheard of, though; for example LINQ-to-SQL gnerated entities would live in the DAL.

    Other options:

    • put them into a common lower assembly (but that may leave your BL rather empty)
    • use IOC to remove / reverse the reference between BL/DAL

    There are no single right answers here.

    Re DataTable; personally I agree - I'm not a fan ;) However, they can be used successfully and reasonably. But if I had to use them, I'd be keeping them in the DAL as an implementation detail - and not exposing them above that.

提交回复
热议问题