ORM supporting immutable classes

前端 未结 6 799
暖寄归人
暖寄归人 2021-02-03 22:15

Which ORM supports a domain model of immutable types?

I would like to write classes like the following (or the Scala equivalent):

class          


        
6条回答
  •  抹茶落季
    2021-02-03 22:52

    AFAIK, there are no ORMs for .NET supporting this feature exactly as you wish. But you can take a look at BLTookit and LINQ to SQL - both provide update-by-comparison semantics and always return new objects on materialization. That's nearly what you need, but I'm not sure about collections there.

    Btw, why you need this feature? I'm aware about pure functional languages & benefits of purely imutable objects (e.g. complete thread safety). But in case with ORM all the things you do with such objects are finally transformed to a sequence of SQL commands anyway. So I admit the benefits of using such objects are vaporous here.

提交回复
热议问题