Facade Design Patterns and Subclassing
- by Code Sherpa
Hi.
I am using a facade design pattern for a C# program. The program basically
looks like this...
public class Api
{
#region Constants
private const int version = 1;
#endregion
#region Private Data
private XProfile _profile;
private XMembership _membership;
private XRoles _role;
#endregion Private Data
public Api()
{
_membership = new XMembership();
_profile = new XProfile();
_role = new XRoles();
}
public int GetUserId(string name)
{
return _membership.GetIdByName(name);
}
}
Now, as I would like subclass my methods into three categories: Role, Profile, and Member.
This will be easier on the developers eye because both Profile and Membership expose a lot of methods that look similar (and a few by Role). For example, getting a user's ID would look like:
int _id = Namespace.Api.Member.GetUserId("Henry222");
Can somebody "illustrate" how subclassing should work in this case to achieve the effect I am looking for?
Thanks in advance.