Exemple #1
0
 /// <summary>
 /// Checks that the specified tenant is one of the allowable types and throws a
 /// <see cref="InvalidMarainTenantTypeException"/> if it is not.
 /// </summary>
 /// <param name="tenant">The tenant to check.</param>
 /// <param name="allowableTenantTypes">The list of allowable types for the tenant.</param>
 /// <exception cref="InvalidMarainTenantTypeException">The type is not one of the specified types.</exception>
 public static void EnsureTenantIsOfType(this ITenant tenant, params MarainTenantType[] allowableTenantTypes)
 {
     if (!tenant.IsTenantOfType(allowableTenantTypes))
     {
         throw new InvalidMarainTenantTypeException(tenant.Id, tenant.GetMarainTenantType(), allowableTenantTypes);
     }
 }
Exemple #2
0
        /// <summary>
        /// Checks that the specified tenant is one of the allowable types.
        /// </summary>
        /// <param name="tenant">The tenant to check.</param>
        /// <param name="allowableTenantTypes">The list of allowable types for the tenant.</param>
        /// <returns>A boolean indicating whether or not the tenant is one of the specified types.</returns>
        public static bool IsTenantOfType(this ITenant tenant, params MarainTenantType[] allowableTenantTypes)
        {
            MarainTenantType tenantType = tenant.GetMarainTenantType();

            return(allowableTenantTypes.Contains(tenantType));
        }