Exemple #1
0
 private MultitenancyOptions <TTenant> ReplaceTokenString(MultitenancyOptions <TTenant> options, IDictionary <string, string> tokenList)
 {
     options.TenantFolder          = ReplaceWithStringBuilder(options.TenantFolder, tokenList);
     options.Tenants               = FormattedTenantsList(options, tokenList);
     options.TenantsConfigurations = FormattedTenantsConfigurations(options, tokenList);
     return(options);
 }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        private Collection <TTenant> FormattedTenantsList(MultitenancyOptions <TTenant> options, IDictionary <string, string> tokenList)
        {
            string tmpString          = DumpToJsonString(options.Tenants);
            string tenantListAsString = ReplaceWithStringBuilder(tmpString, tokenList);

            return(JsonConvert.DeserializeObject <Collection <TTenant> >(tenantListAsString));
        }
Exemple #3
0
 private void AddAdditionnalKeys(MultitenancyOptions <TTenant> options, IDictionary <string, string> tokenList)
 {
     // Add other tokens.
     foreach (KeyValuePair <string, string> item in options.Tokens)
     {
         tokenList[string.Format(FormatReplacement, item.Key)] = item.Value;
     }
 }
Exemple #4
0
        /// <summary>
        /// TODO :doesn't work very well.
        /// </summary>
        private IEnumerable <IConfigurationSection> FormattedTenantsConfigurations(MultitenancyOptions <TTenant> options, IDictionary <string, string> tokenList)
        {
            IConfigurationSection[] result = options.TenantsConfigurations?.ToArray() ?? Array.Empty <IConfigurationSection>();

            /*
             * for (int i = 0; i < result.Length; ++i)
             * {
             *  IConfigurationSection config = result?[i];
             *
             *  if (config != null)
             *  {
             *      FormattedTenantsConfigurations(config, tokenList);
             *  }
             * }*/

            return(result);
        }
Exemple #5
0
 /// <summary>
 /// Invoked to configure a MultitenancyOptions instance.
 /// </summary>
 /// <param name="name">The name of the options instance being configured.</param>
 /// <param name="options">The MultitenancyOptions instance to configured.</param>
 public void PostConfigure(string name, MultitenancyOptions <TTenant> options)
 {
     AddAdditionnalKeys(options, TokenList);
     options = ReplaceTokenString(options, TokenList);
 }