I'm adding Immutable objects support to my Micro ORM called "Symbiotic"
In the case of a create, I need to pass back a newly created version of the value passed in because the object is immutable and I need to update the newly created identity. For non-immutable values I just set the identity property, but obviously I can't do that now. So I'm thinking of adding a new method called CreateImmutable() with a ref for the value and setting the value with the newly created immutable object with the new identity property value and possibly a changed RowVersion property also. The current method return value is the record changed count, so I want the leave that as is.
I know I could take the easy route and force private property setters, but I would rather support pure immutable types.
Does anyone have any thoughts or potential unforeseen issue on my approach?
public int Create(object value)
proposed new method:
public int CreateImmutable(ref object value)