This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Unregistered : ITennantRegistration | |
{ | |
public ITennantRegistration Regsister() | |
{ | |
return new Registered(); | |
} | |
} | |
public class Registered : ITennantRegistration | |
{ | |
} | |
public class Tennant | |
{ | |
protected ITennantRegistration registration; | |
public Tennant() | |
{ | |
this.registration = new Unregistered(); | |
} | |
public void Register() | |
{ | |
var reg = registration as Unregistered; | |
if(reg!=null) | |
registration = new Registered(); | |
} | |
public void AddUserAccount(string name, string password) | |
{ | |
var reg = registration as Registered; | |
if (reg != null) | |
this.User = new User(reg, name, password); | |
} | |
bool canRegister() | |
{ | |
return true;// check invariant here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment