C# DDD Populate Immutable Objects
        Posted  
        
            by Russel
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Russel
        
        
        
        Published on 2010-05-25T14:24:14Z
        Indexed on 
            2010/05/25
            14:31 UTC
        
        
        Read the original article
        Hit count: 269
        
Hi
I have a immutable Customer class in my domain assembly. It contains the following GET properties : id, firstname and lastname. I have a CustomerRepository class in my persistence assembly. In turn, this CustomerRepository class should populate and return a Customer object using a remote web-serivce.
My Customer class contains no setter properties and it contains a private constructor. The reason - I dont want the UI developer to get the wrong idea - He should not be able to create or change a Customer object.
My question: How do I get my CustomerRepository to populate my Customer object. Reflection? Or should I sacrifice my design and enable a public constructor for constructing the customer object?
© Stack Overflow or respective owner