mercredi 11 février 2015

Domain Driven Design : Can aggregate root have public setter?

If I have a aggregate root says User It have property like



public class User:BaseEntity
{


public User()
{
//Ef Use
}

public User(string firstName, string secondName,
string userName,Password password )
{
this.UserName = userName;
this.Password = password;
this.FirstName = firstName;
this.SecondName = secondName;
}

public string UserName { get; private set;}
public Password Password { get; private set;}
public string FirstName { get; private set;}
public string SecondName { get; private set;}
}


I can create new user like var naz=new User ("naz","password","firstName","secondname") and save using UserRepository . How should I edit User fistname property ?

Should I need to make public setter and Save using repository ? .

I am confused ,new to DDD .How Should I implement this .


Aucun commentaire:

Enregistrer un commentaire