当前位置: 首页>>代码示例>>C#>>正文


C# IContainer.RegisterComponentSettings方法代码示例

本文整理汇总了C#中IContainer.RegisterComponentSettings方法的典型用法代码示例。如果您正苦于以下问题:C# IContainer.RegisterComponentSettings方法的具体用法?C# IContainer.RegisterComponentSettings怎么用?C# IContainer.RegisterComponentSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IContainer的用法示例。


在下文中一共展示了IContainer.RegisterComponentSettings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InstallProvider

 private void InstallProvider(IContainer container, Provider provider)
 {
     if (provider != null)
     {
         Type type = System.Web.Compilation.BuildManager.GetType(provider.Type, false, true);
         if (type == null)
         {
             throw new ConfigurationErrorsException(string.Format("Could not load provider {0}", provider.Type));
         }
         container.RegisterComponent(provider.Name, _ProviderInterface, type, _ComponentLifeStyle);
         Dictionary<string, string> settingsDict = new Dictionary<string, string>();
         settingsDict.Add("providerName", provider.Name);
         foreach (string key in provider.Attributes.Keys)
         {
             settingsDict.Add(key, provider.Attributes.Get(key));
         }
         container.RegisterComponentSettings(type.FullName, settingsDict);
     }
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:19,代码来源:ProviderInstaller.cs

示例2: InstallProvider

        private void InstallProvider(IContainer container, Provider provider)
        {
            if (provider != null)
            {
                Type type = null;

                //Get the provider type
                try
                {
                    type = BuildManager.GetType(provider.Type, false, true);
                 }
                catch (TypeLoadException)
                {
                    if (_defaultProvider != null)
                    {
                        type = _defaultProvider;
                    }
                }

                if (type == null)
                {
                    Logger.Error(new ConfigurationErrorsException(string.Format("Could not load provider {0}", provider.Type)));
                }
                else
                {
                    //Register the component
                    container.RegisterComponent(provider.Name, _ProviderInterface, type, _ComponentLifeStyle);

                    //Load the settings into a dictionary
                    var settingsDict = new Dictionary<string, string> { { "providerName", provider.Name } };
                    foreach (string key in provider.Attributes.Keys)
                    {
                        settingsDict.Add(key, provider.Attributes.Get(key));
                    }
                    //Register the settings as dependencies
                    container.RegisterComponentSettings(type.FullName, settingsDict);
                }
            }
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:39,代码来源:ProviderInstaller.cs


注:本文中的IContainer.RegisterComponentSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。