What's wrong with Linq to SQL?

前端 未结 11 2082
春和景丽
春和景丽 2021-01-02 09:34

What\'s wrong with Linq to SQL?

Or - what about Linq to SQL would make it unsuitable for a project, either new or existing? I want to hear about why you would

11条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-02 09:49

    A true ORM should separate the design of your Business Entities from your persistence medium. That way you can refactor either one of them separately and only have to maintain the mapping between the two. This reduces the amount of application logic code that you need to maintain for database changes.

    To accomplish this kind of persistence agnostic approach with Linq-to-SQL, you would have to use its generated classes at DTOs and maintain a mapping logic between your DTOs and your Entities.

    There are much better ORMs for taking this approach (like NHibernate) that greatly reduce the need for DTOs.

提交回复
热议问题