• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IServiceRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IServiceRegistry的典型用法代码示例。如果您正苦于以下问题:C# IServiceRegistry类的具体用法?C# IServiceRegistry怎么用?C# IServiceRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IServiceRegistry类属于命名空间,在下文中一共展示了IServiceRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: typeof

        void ICompositionRoot.Compose(IServiceRegistry serviceRegistry)
        {
            CallCount++;
            serviceRegistry.Register<IFoo,Foo>();

            serviceRegistry.RegisterFallback((type, s) => type == typeof(IBar), request => new Bar());
        }
开发者ID:vitamink,项目名称:LightInject,代码行数:7,代码来源:CompositionRoot.cs


示例2: SceneSystem

 /// <summary>
 /// Initializes a new instance of the <see cref="GameSystemBase" /> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 /// <remarks>The GameSystem is expecting the following services to be registered: <see cref="IGame" /> and <see cref="IAssetManager" />.</remarks>
 public SceneSystem(IServiceRegistry registry)
     : base(registry)
 {
     registry.AddService(typeof(SceneSystem), this);
     Enabled = true;
     Visible = true;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:12,代码来源:SceneSystem.cs


示例3: DynamicEffectCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicEffectCompiler" /> class.
        /// </summary>
        /// <param name="services">The services.</param>
        /// <param name="effectName">Name of the effect.</param>
        /// <param name="asyncDynamicEffectCompiler">if set to <c>true</c> it can compile effect asynchronously.</param>
        /// <exception cref="System.ArgumentNullException">services
        /// or
        /// effectName</exception>
        public DynamicEffectCompiler(IServiceRegistry services, string effectName, int taskPriority = 0)
        {
            if (services == null) throw new ArgumentNullException("services");
            if (effectName == null) throw new ArgumentNullException("effectName");

            Services = services;
            this.effectName = effectName;
            this.taskPriority = taskPriority;
            EffectSystem = Services.GetSafeServiceAs<EffectSystem>();
            GraphicsDevice = Services.GetSafeServiceAs<IGraphicsDeviceService>().GraphicsDevice;
            parameterCollections = new FastList<ParameterCollection>();

            // Default behavior for fallback effect: load effect with same name but empty compiler parameters
            ComputeFallbackEffect = (dynamicEffectCompiler, type, name, parameters) =>
            {
                ParameterCollection usedParameters;
                var compilerParameters = new CompilerParameters();

                // We want high priority
                compilerParameters.TaskPriority = -1;

                var effect = dynamicEffectCompiler.EffectSystem.LoadEffect(effectName, compilerParameters, out usedParameters).WaitForResult();
                return new ComputeFallbackEffectResult(effect, usedParameters);
            };
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:34,代码来源:DynamicEffectCompiler.cs


示例4: YamlManager

 /// <summary>
 /// Initializes a new instance of the <see cref="GameSystem" /> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 public YamlManager(IServiceRegistry registry) : base(registry)
 {
     Services.AddService(this);
     yamlSettings = new SerializerSettings();
     attributeRegistry = yamlSettings.Attributes;
     serializer = new Serializer(yamlSettings);
 }
开发者ID:GrafSeismo,项目名称:SharpDX,代码行数:11,代码来源:YamlManager.cs


示例5: GameSystemBase

 /// <summary>
 /// Initializes a new instance of the <see cref="GameSystemBase" /> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 /// <remarks>
 /// The GameSystem is expecting the following services to be registered: <see cref="IGame"/> and <see cref="IAssetManager"/>.
 /// </remarks>
 protected GameSystemBase(IServiceRegistry registry)
 {
     if (registry == null) throw new ArgumentNullException("registry");
     this.registry = registry;
     game = (GameBase)Services.GetServiceAs<IGame>();
     assetManager = Services.GetSafeServiceAs<IAssetManager>();
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:14,代码来源:GameSystemBase.cs


示例6: ScriptSystem

 /// <summary>
 /// Initializes a new instance of the <see cref="GameSystemBase" /> class.
 /// </summary>
 /// <param name="registry">The registry.</param>
 /// <remarks>The GameSystem is expecting the following services to be registered: <see cref="IGame" /> and <see cref="AssetManager" />.</remarks>
 public ScriptSystem(IServiceRegistry registry)
     : base(registry)
 {
     Enabled = true;
     Scheduler = new Scheduler();
     Services.AddService(typeof(ScriptSystem), this);
 }
开发者ID:Powerino73,项目名称:paradox,代码行数:12,代码来源:ScriptSystem.cs


示例7: AudioSystem

        /// <summary>
        /// Create an new instance of AudioSystem
        /// </summary>
        /// <param name="registry">The service registry in which to register the <see cref="AudioSystem"/> services</param>
        public AudioSystem(IServiceRegistry registry)
            : base(registry)
        {
            Enabled = true;

            registry.AddService(typeof(AudioSystem), this);
        }
开发者ID:cg123,项目名称:xenko,代码行数:11,代码来源:AudioSystem.cs


示例8: Compose

        public void Compose(IServiceRegistry serviceRegistry)
        {
            // Register the app repository
            serviceRegistry.Register<IAppRepository, AppRepository>();

            // Register the app resource types
            serviceRegistry.Register<IAppSprite, AppSprite>();
            serviceRegistry.Register<IAppSound, AppSound>();
            serviceRegistry.Register<IAppBackground, AppBackground>();
            serviceRegistry.Register<IAppPath, AppPath>();
            serviceRegistry.Register<IAppScript, AppScript>();
            serviceRegistry.Register<IAppDataFile, AppDataFile>();
            serviceRegistry.Register<IAppFont, AppFont>();
            serviceRegistry.Register<IAppTimeline, AppTimeline>();
            serviceRegistry.Register<IAppObject, AppObject>();
            serviceRegistry.Register<IAppRoom, AppRoom>();

            // Register teh resource managers
            serviceRegistry.Register<IIndexedResourceManager<IAppSprite>, IndexedResourceManager<IAppSprite>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppSound>, IndexedResourceManager<IAppSound>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppBackground>, IndexedResourceManager<IAppBackground>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppPath>, IndexedResourceManager<IAppPath>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppScript>, IndexedResourceManager<IAppScript>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppDataFile>, IndexedResourceManager<IAppDataFile>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppFont>, IndexedResourceManager<IAppFont>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppTimeline>, IndexedResourceManager<IAppTimeline>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppObject>, IndexedResourceManager<IAppObject>>();
            serviceRegistry.Register<IIndexedResourceManager<IAppRoom>, IndexedResourceManager<IAppRoom>>();
        }
开发者ID:joshwyant,项目名称:game-creator,代码行数:29,代码来源:CompositionRoot.cs


示例9: Compose

 public void Compose(IServiceRegistry serviceRegistry)
 {            
     serviceRegistry.Register<ILogFactory, Log4NetLogFactory>(new PerContainerLifetime());
     serviceRegistry.Register<Type, ILog>((factory, type) => factory.GetInstance<ILogFactory>().GetLogger(type));
     serviceRegistry.RegisterConstructorDependency(
         (factory, info) => factory.GetInstance<Type, ILog>(info.Member.DeclaringType));            
 }
开发者ID:seesharper,项目名称:Blog.WebApiRequestLogging,代码行数:7,代码来源:CompositionRoot.cs


示例10: addServices

        private static void addServices(IServiceRegistry registry)
        {
            var pipeline = new AssetPipeline();
            registry.SetServiceIfNone<IAssetPipeline>(pipeline);
            registry.SetServiceIfNone<IAssetFileRegistration>(pipeline);

            registry.SetServiceIfNone(new AssetGraph());
            registry.SetServiceIfNone(new AssetLogsCache());

            registry.SetServiceIfNone<IAssetTagWriter, AssetTagWriter>();

            registry.SetServiceIfNone<ICombinationDeterminationService, CombinationDeterminationService>();

            registry.SetServiceIfNone<IAssetCombinationCache, AssetCombinationCache>();
            registry.SetServiceIfNone<IAssetDependencyFinder, AssetDependencyFinderCache>();
            registry.SetServiceIfNone<IAssetTagPlanner, AssetTagPlanner>();
            registry.SetServiceIfNone<IAssetTagBuilder, AssetTagBuilder>();
            registry.SetServiceIfNone<IAssetRequirements, AssetRequirements>();

            registry.SetServiceIfNone<IMissingAssetHandler, TraceOnlyMissingAssetHandler>();

            registry.SetServiceIfNone<IAssetTagPlanCache, AssetTagPlanCache>();

            registry.SetServiceIfNone<ITransformerPolicyLibrary, TransformerPolicyLibrary>();

            registry.SetServiceIfNone<IContentPlanner, ContentPlanner>();
            registry.SetServiceIfNone<IContentPlanCache, ContentPlanCache>();
            registry.SetServiceIfNone<IContentPipeline, ContentPipeline>();

            registry.SetServiceIfNone<IContentWriter, ContentWriter>();

            registry.SetServiceIfNone<IETagGenerator<IEnumerable<AssetFile>>, AssetFileEtagGenerator>();
        }
开发者ID:roynmoore,项目名称:fubumvc,代码行数:33,代码来源:AssetServicesRegistry.cs


示例11: configureServices

        private void configureServices(IServiceRegistry services)
        {
            var configuration = new TemplateServiceConfiguration {BaseTemplateType = typeof (FubuRazorView)};

            services.ReplaceService<ITemplateRegistry<IRazorTemplate>>(_templateRegistry);
            services.ReplaceService<IFubuTemplateService>(new FubuTemplateService(_templateRegistry, new TemplateService(configuration), new FileSystem()));
            services.ReplaceService<ITemplateServiceConfiguration>(configuration);
            services.ReplaceService<IParsingRegistrations<IRazorTemplate>>(_parsings);
            services.SetServiceIfNone<ITemplateDirectoryProvider<IRazorTemplate>, TemplateDirectoryProvider<IRazorTemplate>>();
            services.SetServiceIfNone<ISharedPathBuilder>(new SharedPathBuilder());

            var graph = new SharingGraph();
            services.SetServiceIfNone(graph);
            services.SetServiceIfNone<ISharingGraph>(graph);


            services.FillType<IActivator, RazorActivator>();

            services.FillType<ISharedTemplateLocator<IRazorTemplate>, SharedTemplateLocator<IRazorTemplate>>();
            services.FillType<ISharingAttacher<IRazorTemplate>, MasterAttacher<IRazorTemplate>>();
            services.FillType<ITemplateSelector<IRazorTemplate>, RazorTemplateSelector>();
            services.FillType<IActivator, SharingAttacherActivator<IRazorTemplate>>();
            services.FillType<IRenderStrategy, AjaxRenderStrategy>();
            services.FillType<IRenderStrategy, DefaultRenderStrategy>();

            services.SetServiceIfNone<IViewModifierService<IFubuRazorView>, ViewModifierService<IFubuRazorView>>();

            services.FillType<IViewModifier<IFubuRazorView>, LayoutActivation>();
            services.FillType<IViewModifier<IFubuRazorView>, PartialRendering>();
            services.FillType<IViewModifier<IFubuRazorView>, FubuPartialRendering>();
        }
开发者ID:hartez,项目名称:FubuMVC.ViewEngines,代码行数:31,代码来源:RazorEngine.cs


示例12: SpriteAnimationSystem

        /// <summary>
        /// Creates a new instance of <see cref="SpriteAnimationSystem"/> and register it in the services.
        /// </summary>
        /// <param name="registry"></param>
        public SpriteAnimationSystem(IServiceRegistry registry)
            : base(registry)
        {
            registry.AddService(typeof(SpriteAnimationSystem), this);

            DefaultFramesPerSecond = 30;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:11,代码来源:SpriteAnimationSystem.cs


示例13: GameFontSystem

 public GameFontSystem(IServiceRegistry registry)
     : base(registry)
 {
     Visible = true;
     FontSystem = new FontSystem();
     Services.AddService(typeof(FontSystem), FontSystem);
     Services.AddService(typeof(IFontFactory), FontSystem);
 }
开发者ID:cg123,项目名称:xenko,代码行数:8,代码来源:GameFontSystem.cs


示例14: Bullet2PhysicsSystem

        public Bullet2PhysicsSystem(IServiceRegistry registry)
            : base(registry)
        {
            UpdateOrder = -1000; //make sure physics runs before everything
            registry.AddService(typeof(IPhysicsSystem), this);

            Enabled = true; //enabled by default
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:8,代码来源:Bullet2PhysicsSystem.cs


示例15: AudioSystem

        /// <summary>
        /// Create an new instance of AudioSystem
        /// </summary>
        /// <param name="registry">The service registry in which to register the <see cref="AudioSystem"/> services</param>
        public AudioSystem(IServiceRegistry registry)
            : base(registry)
        {
            Enabled = true;
            AudioEngine = AudioEngineFactory.NewAudioEngine();

            registry.AddService(typeof(AudioSystem), this);
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:12,代码来源:AudioSystem.cs


示例16: Register

        private static void Register(this Container container, IServiceRegistry registry)
        {
            container.Register(registry.TypeRegistrations);

            container.Register(registry.CollectionTypeRegistrations);

            container.Register(registry.InstanceRegistrations);
        }
开发者ID:MinistroFx,项目名称:Ministro,代码行数:8,代码来源:ContainerExtensions.cs


示例17: NewInputManagerWinforms

        private static InputManager NewInputManagerWinforms(IServiceRegistry registry)
        {
#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP && SILICONSTUDIO_XENKO_UI_WINFORMS
            return new InputManagerWinforms(registry);
#else
            return null;
#endif
        }
开发者ID:hsabaleuski,项目名称:paradox,代码行数:8,代码来源:InputManagerFactory.cs


示例18: Compose

        public void Compose(IServiceRegistry serviceRegistry)
        {
            serviceRegistry.Register<IAspectSerializer, AspectDataContractSerializer>(typeof(AspectDataContractSerializer).FullName, new PerContainerLifetime());

            serviceRegistry.Register<IAspectSerializer, AspectXmlSerializer>(typeof(AspectXmlSerializer).FullName, new PerContainerLifetime());

            serviceRegistry.Register<IAspectSerializerFactory, AspectSerializerFactory>(new PerContainerLifetime());
        }
开发者ID:raulnq,项目名称:Jal.Aop,代码行数:8,代码来源:AspectSerializerCompositionRoot.cs


示例19: ConfigureContainer

 private void ConfigureContainer(IServiceRegistry registry)
 {
     registry.RegisterInstance<IFodyLogger>(this);
     registry.RegisterInstance<ModuleWeaver>(this);
     registry.RegisterInstance<ModuleDefinition>(this.ModuleDefinition);
     registry.RegisterAssembly(GetType().Assembly
         , (serviceType, implementingType) => typeof(IModuleProcessor).IsAssignableFrom(implementingType));
 }
开发者ID:brainoffline,项目名称:Commander.Fody,代码行数:8,代码来源:ModuleWeaver.cs


示例20: Load

 public void Load(IServiceRegistry registry)
 {
     if (!registry.IsRegistered(typeof (IEventAggregator)))
     {
         registry.Register<IEventAggregator, EventAggregator>(true);
     }
     registry.Register<IMessageBus, PrismMessageBus>(true);
 }
开发者ID:ChristianEder,项目名称:Cherry,代码行数:8,代码来源:PrismMessageBusModule.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IServiceRequest类代码示例发布时间:2022-05-24
下一篇:
C# IServiceProvider类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap