Created
February 6, 2014 12:50
-
-
Save benfoster/8843578 to your computer and use it in GitHub Desktop.
Tenant Resolver API
This file contains hidden or 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
// 1. Return identifiers using out parameter | |
public interface ITenantResolver<TTenant> | |
{ | |
Task<TTenant> Resolve(string identifier, out string[] tenantIdentifiers); | |
} | |
// 2. Return ResolvedTenant object containing identifiers | |
public interface ITenantResolver<TTenant> | |
{ | |
Task<ResolvedTenant<TTenant>> Resolve(string identifier); | |
} | |
public class ResolvedTenant<TTenant> | |
{ | |
public TTenant Tenant { get; set; } | |
public string[] Identifiers { get; set; } | |
} |
jchannon
commented
Feb 6, 2014
Out parameters are one of the banes of our universe. So therefore, I agree with nancy boy.
I was trying to avoid imposing a certain tenant structure so people could return whatever they like without having to implement any kind of interface or have a dependency on Saaskit.
That was for the reason for wrapping the tenant type in ResolvedTenant
.
no out parameters. ever.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment