8
shouts

Pleasing the O/R Mapper – Default Constructor Hack - Roger Alsing

published 306 days, 4 hours, 50 minutes ago posted by MihirPatelMihirPatel 306 days, 19 hours, 34 minutes ago
Tuesday, May 12, 2009 11:06:46 AM GMT Monday, May 11, 2009 8:22:17 PM GMT

Hack of the day:

Most O/R mapper frameworks require entities to implement a default constructor.

This is most often not a big deal, most entities would support a default constructor no matter if the mapper needed it or not.

However, if you intend to expose an entity that only support a copy constructor.

Let’s say for the sake of the argument that we have an immutable “Order” class, that can only be created by passing an “OrderRequest”:

public class Order {    public Order( OrderRequest request )   ...

category: Foundation | clicked: 0 | | source: rogeralsing.com | show counter code
tags: C#