/// <summary>
 /// Creates a new instance of the <see cref="InvalidMarainTenantTypeException"/>.
 /// </summary>
 /// <param name="tenantId">The Id of the tenant.</param>
 /// <param name="actualTenantType">The actual <see cref="MarainTenantType"/> of the tenant.</param>
 /// <param name="allowableTenantTypes">The valid values for <see cref="MarainTenantType"/>.</param>
 public InvalidMarainTenantTypeException(
     string tenantId,
     MarainTenantType actualTenantType,
     params MarainTenantType[] allowableTenantTypes)
     : base($"The tenant with Id '{tenantId}' has a tenant type of '{actualTenantType}'. Valid tenant type(s) here are: {string.Join(", ", allowableTenantTypes)}")
 {
 }
Пример #2
0
 /// <summary>
 /// Creates repository configuration properties to set the Marain tenant type of the tenant.
 /// </summary>
 /// <param name="values">Existing configuration values to which to append these.</param>
 /// <param name="marainTenantType">The tenant type to set.</param>
 /// <remarks>
 /// This method does not persist the tenant. Calling code should pass the resulting list to
 /// <see cref="ITenantStore.UpdateTenantAsync(string, string?, IEnumerable{KeyValuePair{string, object}}?, IEnumerable{string}?)"/>.
 /// </remarks>
 /// <returns>
 /// Properties to pass to
 /// <see cref="ITenantStore.UpdateTenantAsync(string, string?, IEnumerable{KeyValuePair{string, object}}?, IEnumerable{string}?)"/>.
 /// </returns>
 internal static IEnumerable <KeyValuePair <string, object> > AddMarainTenantType(
     this IEnumerable <KeyValuePair <string, object> > values,
     MarainTenantType marainTenantType) =>
 values.Append(new KeyValuePair <string, object>(TenantPropertyKeys.MarainTenantType, marainTenantType));
Пример #3
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));
        }