Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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