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


C# IRegistry.RegisterInstance方法代码示例

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


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

示例1: SetupExtensibility

		private static void SetupExtensibility(IRegistry registry)
		{
			var dynamicProxy = new CastleDynamicProxyProvider();
			var aopRepository = new AspectRepository(dynamicProxy);

			var dllPlugins =
				(from key in ConfigurationManager.AppSettings.AllKeys
				 where key.StartsWith("PluginsPath", StringComparison.OrdinalIgnoreCase)
				 let path = ConfigurationManager.AppSettings[key]
				 let pathRelative = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path)
				 let chosenPath = Directory.Exists(pathRelative) ? pathRelative : path
				 select chosenPath)
				.ToList();
			registry.RegisterInstance(new PluginsConfiguration { Directories = dllPlugins });

			registry.Register<SystemInitialization>();
			registry.Register<IObjectFactory, DryIocObjectFactory>(Reuse.Singleton);
			registry.Register<IExtensibilityProvider, DryIocMefProvider>(Reuse.Singleton);
			registry.Register(typeof(IPluginRepository<>), typeof(PluginRepository<>), Reuse.Singleton);

			registry.RegisterInstance<IAspectRegistrator>(aopRepository);
			registry.RegisterInstance<IAspectComposer>(aopRepository);
			//registry.RegisterInstance<IInterceptorRegistrator>(aopRepository);
			registry.RegisterInstance<IMixinProvider>(dynamicProxy);
			registry.RegisterInstance<IDynamicProxyProvider>(dynamicProxy);
		}
开发者ID:instant-hrvoje,项目名称:revenj,代码行数:26,代码来源:DryIocConfiguration.cs

示例2: Load

		public static void Load(IRegistry registry)
		{
			registry.RegisterInstance<ISystemState>(new ServerState());
			registry.RegisterInstance<IPermissionManager>(new NoAuth());

			registry.Register<IRestApplication, RestApplication>(Reuse.Singleton);
			registry.Register<RestApplication>(Reuse.Singleton);
			//builder.RegisterType<SoapApplication>().As<SoapApplication, ISoapApplication>();
			registry.Register<ICommandConverter, CommandConverter>(Reuse.Singleton);

			SetupExtensibility(registry);
			SetupPostgres(registry);
			SetupPatterns(registry);
			SetupSerialization(registry);

			//builder.RegisterType<RepositoryAuthentication>().As<IAuthentication>();
			//builder.RegisterType<RepositoryPrincipalFactory>().As<IPrincipalFactory>();
			//registry.Register<IPermissionManager, PermissionManager>(Reuse.Singleton);

			registry.Register<IProcessingEngine, ProcessingEngine>(Reuse.Singleton);
			registry.Register<IScopePool, ScopePool>(Reuse.Singleton);
		}
开发者ID:instant-hrvoje,项目名称:revenj,代码行数:22,代码来源:DryIocConfiguration.cs

示例3: SetupPostgres

        private static void SetupPostgres(IRegistry registry)
        {
            var cs = ConfigurationManager.AppSettings["ConnectionString"];
            if (string.IsNullOrEmpty(cs))
                throw new ConfigurationErrorsException(@"ConnectionString is missing from configuration. Add ConnectionString to <appSettings>
            Example: <add key=""ConnectionString"" value=""server=postgres.localhost;port=5432;database=MyDatabase;user=postgres;password=123456;encoding=unicode"" />");

            registry.RegisterInstance(new NGS.DatabasePersistence.Postgres.ConnectionInfo(cs));
            registry.Register<IDatabaseQueryManager, PostgresQueryManager>(Reuse.InCurrentScope);
            registry.Register<IPostgresDatabaseQuery, PostgresDatabaseQuery>();
            registry.RegisterDelegate(r => r.Resolve<IDatabaseQueryManager>().CreateQuery(), Reuse.InCurrentScope);
            registry.Register<IDataChangeNotification, PostgresDatabaseNotification>(Reuse.Singleton);
            registry.Register<IEagerNotification, PostgresDatabaseNotification>(Reuse.Singleton);

            registry.Register<IPostgresConverterRepository, PostgresObjectFactory>(Reuse.Singleton);
            registry.Register<IPostgresConverterFactory, PostgresObjectFactory>(Reuse.Singleton);

            registry.Register<NGS.DatabasePersistence.Postgres.QueryGeneration.QueryExecutor>();
        }
开发者ID:nutrija,项目名称:revenj,代码行数:19,代码来源:DryIocConfiguration.cs


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