public void test_manual_rebind() { var registry = new ServiceRegistry(); registry.Register<IDepA, ImplA>(); registry.Clear<IDepA>(); registry.Register<IDepA, ImplA2>(); }
private void configureServices(ServiceRegistry 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>(); }
public ServiceRegistryLog(ServiceRegistry registry, ProvenanceChain provenanceChain) { _registry = registry; _provenanceChain = registry.GetType() == typeof(ServiceRegistry) ? provenanceChain : provenanceChain.Push(new ServiceRegistryProvenance(registry)); Id = Guid.NewGuid(); _description = new Lazy<Description>(() => Description.For(registry)); }
public void test_manual_register_gameobject() { var registry = new ServiceRegistry(); var rp = this.SpawnComponent<ImplComponent>(); registry.Register<IDepCmp, ImplComponent>(rp); this.TearDown(); }
private void configureServices(ServiceRegistry services) { services.ReplaceService<ITemplateRegistry<IRazorTemplate>>(_templateRegistry); services.SetServiceIfNone<IRazorTemplateGenerator, RazorTemplateGenerator>(); services.SetServiceIfNone<ITemplateCompiler, TemplateCompiler>(); services.SetServiceIfNone<ITemplateFactory, TemplateFactoryCache>(); services.ReplaceService<IParsingRegistrations<IRazorTemplate>>(_parsings); services.SetServiceIfNone<ITemplateDirectoryProvider<IRazorTemplate>, TemplateDirectoryProvider<IRazorTemplate>>(); services.SetServiceIfNone<ISharedPathBuilder>(new SharedPathBuilder()); services.SetServiceIfNone<IPartialRenderer, PartialRenderer>(); var graph = new SharingGraph(); services.SetServiceIfNone(graph); services.SetServiceIfNone<ISharingGraph>(graph); services.FillType<ISharedTemplateLocator<IRazorTemplate>, SharedTemplateLocator<IRazorTemplate>>(); services.FillType<ISharingAttacher<IRazorTemplate>, MasterAttacher<IRazorTemplate>>(); services.FillType<ITemplateSelector<IRazorTemplate>, RazorTemplateSelector>(); services.FillType<Bottles.IActivator, SharingAttacherActivator<IRazorTemplate>>(); services.FillType<IRenderStrategy, AjaxRenderStrategy>(); services.FillType<IRenderStrategy, DefaultRenderStrategy>(); services.SetServiceIfNone<IViewModifierService<IFubuRazorView>, ViewModifierService<IFubuRazorView>>(); services.FillType<IViewModifier<IFubuRazorView>, FubuPartialRendering>(); }
public void Register(ServiceRegistry registry) { registry.Register<IDepA, ImplA>(); registry.Register<IDepB, ImplB>(); registry.Register<IDepC, ImplRecursive>(); registry.Register<IDepCmp, ImplComponent>(_component); registry.Register<ImplAutoDep>(); }
public void fill_service_with_nothing_should_add_the_service() { var registry1 = new HtmlConventionRegistry(); var services = new ServiceRegistry(); services.SetServiceIfNone(registry1); services.FindAllValues<HtmlConventionRegistry>().ShouldHaveTheSameElementsAs(registry1); }
private static void registerCompiler(ServiceRegistry registry) { var compilerDef = registry.SetServiceIfNone(typeof (ICoffeeCompiler), typeof (SassCoffeeCompiler)); var innerCompilerDef = ObjectDef.ForType<CoffeeScriptCompiler>(); var instanceProvider = ObjectDef.ForType<InstanceProvider<IJavaScriptRuntime>>(); Func<IJavaScriptRuntime> runtimeFunc = () => new IEJavaScriptRuntime(); instanceProvider.DependencyByValue(typeof(Func<IJavaScriptRuntime>), runtimeFunc); innerCompilerDef.Dependency(typeof(IInstanceProvider<IJavaScriptRuntime>), instanceProvider); compilerDef.Dependency(typeof(CoffeeScriptCompiler), innerCompilerDef); }
public void fill_service_that_has_something_already_does_not_add_values() { var registry1 = new HtmlConventionRegistry(); var registry2 = new HtmlConventionRegistry(); var services = new ServiceRegistry(); services.AddService(registry1); services.SetServiceIfNone(registry2); services.FindAllValues<HtmlConventionRegistry>().ShouldHaveTheSameElementsAs(registry1); }
#pragma warning disable 28 public static int Main(IDictionary<string, object> env) { bool requireFirstRunOnProjectUpgrade = false; bool inSystem = true; var serviceRegistry = new ServiceRegistry(); serviceRegistry = serviceRegistry.Override<IEnvironment>(() => { var cdenv = new CurrentDirectoryEnvironment(LocalFileSystem.Instance.GetDirectory(env.CurrentDirectory())) { BeforeProjectRepositoryInitialized = (dir, options) => { requireFirstRunOnProjectUpgrade = dir.GetFile("packages").Exists == false; inSystem = false; } }; if (env.SysPath() != null) cdenv.SystemRepositoryDirectory = LocalFileSystem.Instance.GetDirectory(new Path(env.SysPath()).Combine("wraps")); return cdenv; }); if (env.ShellArgs().ContainsNoCase("UseSystem")) { serviceRegistry .Override(() => new RuntimeAssemblyResolver { IgnoreProjectAssemblies = true }) .Override<ICommandRepository>(() => new CommandRepository( ServiceLocator.GetService<IPackageManager>().CommandExports( ServiceLocator.GetService<IEnvironment>(), true) .SelectMany(x => x) .Select(x => x.Descriptor))); } var formatterType = env.Formatter(); if (formatterType != null) { serviceRegistry.Override(() => (ICommandOutputFormatter)Activator.CreateInstance(Type.GetType(formatterType))); } serviceRegistry.Initialize(); //if (requireFirstRunOnProjectUpgrade) //{ // ServiceLocator.GetService<ICommandOutputFormatter>().Render( // new Warning("This is the first time you run a version of OpenWrap that supports post-install hooks on this project. Please wait while we run the hooks for the current packages.")); // serviceRegistry.Initialize(); //} return new ConsoleCommandExecutor(ServiceLocator.GetService<IEnumerable<ICommandLocator>>(), ServiceLocator.GetService<IEventHub>(), ServiceLocator.GetService<ICommandOutputFormatter>()) .Execute(env.CommandLine(), env.ShellArgs()); }
public void CanLoadModTest() { var serviceRegistry = new ServiceRegistry(_scriptRegistry, _depResolver); _contentEngine = new SN.withSIX.ContentEngine.Infra.ContentEngine(serviceRegistry, _scriptRegistry, _realResourceService); var acre2 = A.Fake<IMod>(); var modController = SetupFakeModController(acre2); var mod = _contentEngine.LoadModS(acre2); A.CallTo(() => _scriptRegistry.RegisterMod(A<RegisteredMod>.That.Not.IsNull())).MustHaveHappened(); }
private void configureServices(ServiceRegistry services) { services.ReplaceService<ISparkTemplateRegistry>(_templateRegistry); services.ReplaceService<ITemplateRegistry<ITemplate>>(_templateRegistry); services.ReplaceService<IParsingRegistrations<ITemplate>>(_parsings); var graph = new SharingGraph(); services.SetServiceIfNone(graph); services.SetServiceIfNone<ISharingGraph>(graph); services.SetServiceIfNone<ISparkViewEngine>(new SparkViewEngine()); services.SetServiceIfNone<ICacheService>(new DefaultCacheService(HttpRuntime.Cache)); services.SetServiceIfNone(new SharingLogsCache()); services.FillType<IActivator, SharingConfigActivator>(); services.FillType<IActivator, SharingPolicyActivator>(); services.FillType<IActivator, SharingAttacherActivator<ITemplate>>(); services.FillType<IActivator, SparkActivator>(); services.FillType<IActivator, SparkPrecompiler>(); services.FillType<ISharingAttacher<ITemplate>, MasterAttacher<ITemplate>>(); services.FillType<ISharingAttacher<ITemplate>, BindingsAttacher>(); services.SetServiceIfNone<ISharedPathBuilder>(new SharedPathBuilder()); services.SetServiceIfNone<ITemplateDirectoryProvider<ITemplate>, TemplateDirectoryProvider<ITemplate>>(); services.SetServiceIfNone<ISharedTemplateLocator, SharedTemplateLocator>(); services.FillType<ISharedTemplateLocator<ITemplate>, SharedTemplateLocator>(); services.FillType<IRenderStrategy, NestedRenderStrategy>(); services.FillType<IRenderStrategy, AjaxRenderStrategy>(); services.FillType<IRenderStrategy, DefaultRenderStrategy>(); services.FillType<ITemplateSelector<ITemplate>, SparkTemplateSelector>(); services.SetServiceIfNone<IViewEntryProviderCache, ViewEntryProviderCache>(); services.SetServiceIfNone<IViewModifierService<IFubuSparkView>, ViewModifierService<IFubuSparkView>>(); services.FillType<IViewModifier<IFubuSparkView>, SiteResourceAttacher>(); services.FillType<IViewModifier<IFubuSparkView>, ContentActivation>(); services.FillType<IViewModifier<IFubuSparkView>, OnceTableActivation>(); services.FillType<IViewModifier<IFubuSparkView>, OuterViewOutputActivator>(); services.FillType<IViewModifier<IFubuSparkView>, NestedViewOutputActivator>(); services.FillType<IViewModifier<IFubuSparkView>, ViewContentDisposer>(); services.FillType<IViewModifier<IFubuSparkView>, NestedOutputActivation>(); services.SetServiceIfNone<IHtmlEncoder, DefaultHtmlEncoder>(); services.SetServiceIfNone(new DefaultViewDefinitionPolicy()); services.SetServiceIfNone<IViewDefinitionResolver, ViewDefinitionResolver>(); }
public void test_duplicate_registration() { var registry = new ServiceRegistry(); registry.Register<IDepA, ImplA>(); try { registry.Register<IDepA, ImplA2>(); Unreachable(); } catch (BindException err) { Assert(err.ErrorCode == BindError.DuplicateBinding); } }
#pragma warning disable 28 public static int Main(IDictionary<string, object> env) { bool requireFirstRunOnProjectUpgrade = false; var serviceRegistry = new ServiceRegistry(); serviceRegistry = serviceRegistry.Override<IEnvironment>(() => { var cdenv = new CurrentDirectoryEnvironment(LocalFileSystem.Instance.GetDirectory(env.CurrentDirectory())) { BeforeProjectRepositoryInitialized = (dir, options) => { requireFirstRunOnProjectUpgrade = dir.GetFile("packages").Exists == false; } }; var systemRepositoryPath = env.SystemRepositoryPath(); var systemRootPath = env.SystemRootPath(); if (systemRootPath != null) cdenv.SystemRepositoryDirectory = LocalFileSystem.Instance.GetDirectory(new Path(systemRepositoryPath).Combine("wraps")); if (systemRepositoryPath != null) cdenv.SystemRepositoryDirectory = LocalFileSystem.Instance.GetDirectory(new Path(systemRepositoryPath)); return cdenv; }); if (env.ShellArgs().ContainsNoCase("UseSystem")) { serviceRegistry .Override(() => new RuntimeAssemblyResolver { IgnoreProjectAssemblies = true }) .Override<ICommandRepository>(() => new CommandRepository( ServiceLocator.GetService<IPackageManager>().CommandExports( ServiceLocator.GetService<IEnvironment>(), true) .SelectMany(x => x) .Select(x => x.Descriptor))); } var formatterType = env.Formatter(); if (formatterType != null) { serviceRegistry.Override(() => (ICommandOutputFormatter)Activator.CreateInstance(Type.GetType(formatterType))); } serviceRegistry.Initialize(); return new ConsoleCommandExecutor(ServiceLocator.GetService<IEnumerable<ICommandLocator>>(), ServiceLocator.GetService<IEventHub>(), ServiceLocator.GetService<ICommandOutputFormatter>()) .Execute(env.CommandLine(), env.ShellArgs()); }
public void ClearAll() { var registry1 = new HtmlConventionRegistry(); var registry2 = new HtmlConventionRegistry(); var registry3 = new HtmlConventionRegistry(); var registry4 = new HtmlConventionRegistry(); var services = new ServiceRegistry(); services.AddService(registry1); services.AddService(registry2); services.AddService(registry3); services.AddService(registry4); services.ClearAll<HtmlConventionRegistry>(); services.FindAllValues<HtmlConventionRegistry>().Any().ShouldBeFalse(); }
public void GetAllValues() { var registry1 = new HtmlConventionRegistry(); var registry2 = new HtmlConventionRegistry(); var registry3 = new HtmlConventionRegistry(); var registry4 = new HtmlConventionRegistry(); var services = new ServiceRegistry(); services.AddService(registry1); services.AddService(registry2); services.AddService(registry3); services.AddService(registry4); services.AddService<HtmlConventionRegistry, HtmlConventionRegistry>(); services.FindAllValues<HtmlConventionRegistry>() .ShouldHaveTheSameElementsAs(registry1, registry2, registry3, registry4); }
public void GetAllValues() { var registry1 = new FakeRegistryThing(); var registry2 = new FakeRegistryThing(); var registry3 = new FakeRegistryThing(); var registry4 = new FakeRegistryThing(); var services = new ServiceRegistry(); services.AddService(registry1); services.AddService(registry2); services.AddService(registry3); services.AddService(registry4); services.AddService<FakeRegistryThing, FakeRegistryThing>(); services.ToGraph().FindAllValues<FakeRegistryThing>() .ShouldHaveTheSameElementsAs(registry1, registry2, registry3, registry4); }
public void default_chain_resolver_is_registered() { ServiceRegistry.ShouldBeSingleton(typeof(ChainResolutionCache)).ShouldBeTrue(); registeredTypeIs <IChainResolver, ChainResolutionCache>(); }
public void fill_service_that_has_something_already_does_not_add_values() { var registry1 = new FakeRegistryThing(); var registry2 = new FakeRegistryThing(); var services = new ServiceRegistry(); services.AddService(registry1); services.SetServiceIfNone(registry2); services.ToGraph().FindAllValues<FakeRegistryThing>().ShouldHaveTheSameElementsAs(registry1); }
public void TemplateGraph_is_registered_as_a_singleton() { ServiceRegistry.ShouldBeSingleton(typeof(TemplateGraph)).ShouldBeTrue(); registeredTypeIs <TemplateGraph, TemplateGraph>(); }
public void GetServiceWorks2() { // --- Arrange var settings = new ServiceRegistrySettings("default", new List<ServiceContainerSettings> { new ServiceContainerSettings("default", null, new List<MappingSettings> { new MappingSettings(typeof (ISampleRepository), typeof (SampleRepository)), new MappingSettings(typeof (ISampleService), typeof (ISampleService)) }) }); var registry = new ServiceRegistry(settings); // --- Act var service = registry.GetService<ISampleRepository>(); // --- Assert service.ShouldBeOfType(typeof (SampleRepository)); }
public virtual ServiceRegistry AdditionalContainerConfiguration(ServiceRegistry services) { return(services); }
public void IAssetFinder_is_registered_as_a_singleton() { registeredTypeIs <IAssetFinder, AssetFinderCache>(); ServiceRegistry.ShouldBeSingleton(typeof(AssetFinderCache)) .ShouldBeTrue(); }
public void asset_combination_cache_is_registered_as_a_singleton() { registeredTypeIs <IAssetCombinationCache, AssetCombinationCache>(); ServiceRegistry.ShouldBeSingleton(typeof(AssetCombinationCache)).ShouldBeTrue(); }
public void asset_dependency_finder_should_be_registered_as_a_singleton() { registeredTypeIs <IAssetDependencyFinder, AssetDependencyFinderCache>(); ServiceRegistry.ShouldBeSingleton(typeof(AssetDependencyFinderCache)) .ShouldBeTrue(); }
public void content_plan_cache_is_registered_as_a_singleton() { registeredTypeIs <IContentPlanCache, ContentPlanCache>(); ServiceRegistry.ShouldBeSingleton(typeof(ContentPlanCache)); }
public void asset_content_cache_is_registered() { registeredTypeIs <IAssetContentCache, AssetContentCache>(); ServiceRegistry.ShouldBeSingleton(typeof(AssetContentCache)); }
public void asset_tag_plan_cache_is_registered_as_a_singleton() { registeredTypeIs <IAssetTagPlanCache, AssetTagPlanCache>(); ServiceRegistry.ShouldBeSingleton(typeof(AssetTagPlanCache)).ShouldBeTrue(); }
public ServiceRegistryTests() { _underTest = new ServiceRegistry(); }
private void BuildGump() { m_UserInterface = ServiceRegistry.GetService <UserInterfaceService>(); m_World = ServiceRegistry.GetService <WorldModel>(); m_Client = ServiceRegistry.GetService <INetworkClient>(); IsMoveable = true; SaveOnWorldStop = true; GumpLocalID = Mobile.Serial; if (Mobile.IsClientEntity) { AddControl(new GumpPic(this, 0, 0, 0x07d0, 0)); // HELP AddControl(new Button(this, 185, 44 + 27 * 0, 0x07ef, 0x07f0, ButtonTypes.Activate, 0, (int)Buttons.Help)); ((Button)LastControl).GumpOverID = 0x07f1; // OPTIONS AddControl(new Button(this, 185, 44 + 27 * 1, 0x07d6, 0x07d7, ButtonTypes.Activate, 0, (int)Buttons.Options)); ((Button)LastControl).GumpOverID = 0x07d8; // LOG OUT AddControl(new Button(this, 185, 44 + 27 * 2, 0x07d9, 0x07da, ButtonTypes.Activate, 0, (int)Buttons.LogOut)); ((Button)LastControl).GumpOverID = 0x07db; // QUESTS AddControl(new Button(this, 185, 44 + 27 * 3, 0x57b5, 0x57b7, ButtonTypes.Activate, 0, (int)Buttons.Quests)); ((Button)LastControl).GumpOverID = 0x57b6; // SKILLS AddControl(new Button(this, 185, 44 + 27 * 4, 0x07df, 0x07e0, ButtonTypes.Activate, 0, (int)Buttons.Skills)); ((Button)LastControl).GumpOverID = 0x07e1; // GUILD AddControl(new Button(this, 185, 44 + 27 * 5, 0x57b2, 0x57b4, ButtonTypes.Activate, 0, (int)Buttons.Guild)); ((Button)LastControl).GumpOverID = 0x57b3; // PEACE / WAR m_IsWarMode = Mobile.Flags.IsWarMode; int[] btngumps = m_IsWarMode ? WarModeBtnGumps : PeaceModeBtnGumps; m_WarModeBtn = (Button)AddControl(new Button(this, 185, 44 + 27 * 6, btngumps[0], btngumps[1], ButtonTypes.Activate, 0, (int)Buttons.PeaceWarToggle)); ((Button)LastControl).GumpOverID = btngumps[2]; // STATUS AddControl(new Button(this, 185, 44 + 27 * 7, 0x07eb, 0x07ec, ButtonTypes.Activate, 0, (int)Buttons.Status)); ((Button)LastControl).GumpOverID = 0x07ed; // Virtue menu AddControl(m_VirtueMenuButton = new GumpPic(this, 80, 8, 0x0071, 0)); m_VirtueMenuButton.MouseDoubleClickEvent += VirtueMenu_MouseDoubleClickEvent; // Special moves book // AddControl(new GumpPic(this, 158, 200, 0x2B34, 0)); // LastControl.MouseDoubleClickEvent += SpecialMoves_MouseDoubleClickEvent; // equipment slots for hat/earrings/neck/ring/bracelet AddControl(new EquipmentSlot(this, 2, 76, Mobile, EquipLayer.Helm)); AddControl(new EquipmentSlot(this, 2, 76 + 22 * 1, Mobile, EquipLayer.Earrings)); AddControl(new EquipmentSlot(this, 2, 76 + 22 * 2, Mobile, EquipLayer.Neck)); AddControl(new EquipmentSlot(this, 2, 76 + 22 * 3, Mobile, EquipLayer.Ring)); AddControl(new EquipmentSlot(this, 2, 76 + 22 * 4, Mobile, EquipLayer.Bracelet)); // Paperdoll control! AddControl(new PaperDollInteractable(this, 8, 21, Mobile)); } else { AddControl(new GumpPic(this, 0, 0, 0x07d1, 0)); // Paperdoll AddControl(new PaperDollInteractable(this, 8, 21, Mobile)); } // name and title AddControl(new HtmlGumpling(this, 36, 262, 180, 42, 0, 0, string.Format("<span color=#aaa style='font-family:uni0;'>{0}", Mobile.Name))); AddControl(new HtmlGumpling(this, 35, 262, 180, 42, 0, 0, string.Format("<span color=#222 style='font-family:uni0;'>{0}", Mobile.Name))); }
public void ConfigureContainer(ServiceRegistry services) { services.AddLogging(config => { config.ClearProviders(); config.AddConfiguration(Configuration.GetSection("Logging")); config.AddApplicationInsights(); }); //Response Compression - https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-5.0 services.AddResponseCompression(); services.AddCors(options => { options.AddPolicy("SpecificOrigins", builder => { builder.WithOrigins("https://tmireact.azurewebsites.net", "https://theminiindex.com", "https://wwww.theminiindex.com", "http://localhost:3000") .AllowAnyHeader() .AllowAnyMethod(); }); }); services.Configure <CookiePolicyOptions>(options => { options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddSwaggerGen(); services.AddDefaultIdentity <IdentityUser>() .AddRoles <IdentityRole>() .AddEntityFrameworkStores <MiniIndexContext>(); services.AddHangfire(configuration => configuration .SetDataCompatibilityLevel(CompatibilityLevel.Version_170) .UseSimpleAssemblyNameTypeSerializer() .UseRecommendedSerializerSettings() .UseSqlServerStorage(Configuration.GetConnectionString("HangfireConnection"), new SqlServerStorageOptions { CommandBatchMaxTimeout = TimeSpan.FromMinutes(5), SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), QueuePollInterval = TimeSpan.Zero, UseRecommendedIsolationLevel = true, DisableGlobalLocks = true })); services.AddHangfireServer(); services .AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_3_0) .AddRazorOptions(ConfigureRazor); services.AddDbContext <MiniIndexContext>(ConfigureEntityFramework); string facebookAppId = Configuration["Authentication:Facebook:AppId"]; string facebookAppSecret = Configuration["Authentication:Facebook:AppSecret"]; if (facebookAppId != null && facebookAppSecret != null) { services.AddAuthentication() .AddFacebook(facebookOptions => { facebookOptions.AppId = facebookAppId; facebookOptions.AppSecret = facebookAppSecret; }); } services.AddTransient <IEmailSender, EmailSender>(); services.Configure <AuthMessageSenderOptions>(Configuration); services.AddApplicationInsightsTelemetry(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton <ITelemetryInitializer, TelemetryEnrichment>(); services.AddApplicationInsightsTelemetryProcessor <AppInsightsFilter>(); services.Configure <AzureStorageConfig>(Configuration.GetSection("AzureStorageConfig")); services.IncludeRegistry <CoreServices>(); services.IncludeRegistry <WebAppServices>(); }
public static IWebHostBuilder UseLamar(this IWebHostBuilder builder, ServiceRegistry registry) { return(builder.ConfigureServices((context, services) => { services.AddLamar(registry); })); }
/// <summary> /// Primary client entrypoint. /// Initializes a new instance of the <see cref="Client"/> class. /// </summary> public Client() { // -- INIT Log("Init"); // Singleton Instance = this; this.Controllers = new ControllerRegistry { new ClientController(), new UserController(), new CharacterController(), new VehicleController(), }; this.Managers = new ManagerRegistry { new HudManager(), // Resets and hides all HUD elements new MapManager(), // Loads IPLs and blips new MenuManager() // Set initial menu options }; this.Services = new ServiceRegistry { new VehicleService(), // Vehicle tracking service new VehicleRollService(), // Disable rolling cars back over new PlayerDeathService(), // Knock down players rather than death new PlayerIdleService(), // Kick idle players new AutosaveService(), new PedFilterService(), // Block blacklisted peds new AiPoliceService(), // Disable AI police new PlayerIndicatorService(), // Show nearby players new DateTimeService(), // Set the date and time new BlackoutService(), // Allow city blackouts new AtmService(), // Add ATMs new BranchService(), // Add Bank Tellers new DowntownCabService() new Oppening("Systeme") fonction("Wait * 5") }; this.Services.Initialize(); // Attach handlers // -- SERVICE EVENTS // Player Death Service this.Services.First <PlayerDeathService>().OnDowned += (s, e) => { UI.ShowNotification("Downed"); if (this.LocalPlayer.Character.Weapons.Current.Group != WeaponGroup.Unarmed) { this.LocalPlayer.Character.Weapons.Remove(this.LocalPlayer.Character.Weapons.Current); } }; this.Services.First <PlayerDeathService>().OnRevived += (s, e) => Screen.ShowNotification("Revived"); this.Controllers.First <ClientController>().Startup(); }
public override void OnKeyboardReturn(int textID, string text) { INetworkClient client = ServiceRegistry.GetService <INetworkClient>(); client.Send(new RenameCharacterPacket(Mobile.Serial, text)); }
public virtual ServiceRegistry ConfigureAdditionalServices(ServiceRegistry services) { return(services); }
public void ScanTypes(TypeSet types, ServiceRegistry registry) { throw new NotImplementedException(); }
public void RegisterTest() { ServiceRegistry.Register(ft => ft.To <Person>()); //ServiceRegistry.Register(ft=>ft); Assert.IsTrue(ServiceRegistry.HasRegister <IPerson>()); }
public ServiceRegistryProvenance(ServiceRegistry registry) { _registry = registry; }
public void ConstructionWorskWithMultipleContainerAndParents2() { // --- Arrange var settings = new ServiceRegistrySettings("other", new List<ServiceContainerSettings> { new ServiceContainerSettings("default", "other", new List<MappingSettings> { new MappingSettings(typeof (ISampleService), typeof (ISampleService)) }), new ServiceContainerSettings("other", null, new List<MappingSettings> { new MappingSettings(typeof (ISampleRepository), typeof (SampleRepository)), new MappingSettings(typeof (ISampleService), typeof (ISampleService)) }) }); // --- Act var registry = new ServiceRegistry(settings); // --- Assert registry.ContainerCount.ShouldEqual(2); registry["default"].ShouldNotBeNull(); registry["default"].GetRegisteredServices().ShouldHaveCountOf(1); registry["other"].ShouldNotBeNull(); registry["default"].Parent.ShouldBeSameAs(registry["other"]); registry["other"].GetRegisteredServices().ShouldHaveCountOf(2); registry["other"].ShouldBeSameAs(registry.DefaultContainer); }
public void replace_service_by_specifying_types() { var graph = new BehaviorGraph(); var services = new ServiceRegistry(); services.ReplaceService<IOutputWriter, FakeOutputWriter>(); services.As<IConfigurationAction>().Configure(graph); graph.Services.DefaultServiceFor<IOutputWriter>().Type.ShouldEqual(typeof (FakeOutputWriter)); }
public void RemoveServiceWorks() { // --- Arrange var settings = new ServiceRegistrySettings("default", new List<ServiceContainerSettings> { new ServiceContainerSettings("default", null, new List<MappingSettings> { new MappingSettings(typeof (ISampleRepository), typeof (SampleRepository)), new MappingSettings(typeof (ISampleService), typeof (ISampleService)) }) }); var registry = new ServiceRegistry(settings); // --- Act var before = registry.DefaultContainer.GetRegisteredServices(); registry.RemoveService(typeof(ISampleRepository)); var after = registry.DefaultContainer.GetRegisteredServices(); // --- Assert before.ShouldHaveCountOf(2); after.ShouldHaveCountOf(1); }
public IsometricRenderer() { m_SpriteBatch = ServiceRegistry.GetService <SpriteBatch3D>(); Lighting = new IsometricLighting(); }
public void ClearAll() { var registry1 = new FakeRegistryThing(); var registry2 = new FakeRegistryThing(); var registry3 = new FakeRegistryThing(); var registry4 = new FakeRegistryThing(); var services = new ServiceRegistry(); services.AddService(registry1); services.AddService(registry2); services.AddService(registry3); services.AddService(registry4); services.ClearAll<FakeRegistryThing>(); services.ToGraph().FindAllValues<FakeRegistryThing>().Any().ShouldBeFalse(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureContainer(ServiceRegistry services) { services.AddMvc().AddControllersAsServices() .AddJsonOptions(x => { x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); x.JsonSerializerOptions.MaxDepth = 255; }); services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp"; }); services.AddEntityFrameworkSqlServer(); #region setupAuthAndSwagger services.AddAuthentication(c => { c.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; c.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { // Clock skew compensates for server time drift. // We recommend 5 minutes or less: ClockSkew = TimeSpan.FromMinutes(5), // Specify the key used to sign the token: IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("VerticalToDoKeyVerticalToDoKeyVerticalToDoKey")), RequireSignedTokens = true, // Ensure the token hasn't expired: RequireExpirationTime = true, ValidateLifetime = true, // Ensure the token audience matches our audience value (default true): ValidateAudience = false, // Ensure the token was issued by a trusted authorization server (default true): ValidateIssuer = false, }; }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Vertical ToDo API", Version = "v1" }); c.CustomSchemaIds((t) => { return(t.FullName.Replace("+", "")); }); c.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme, new OpenApiSecurityScheme { Name = "Authorization", Type = SecuritySchemeType.ApiKey, Scheme = JwtBearerDefaults.AuthenticationScheme, BearerFormat = "JWT", In = ParameterLocation.Header, Description = "JWT Authorization header using the Bearer scheme." }); c.AddSecurityRequirement(new OpenApiSecurityRequirement { { new OpenApiSecurityScheme { Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = JwtBearerDefaults.AuthenticationScheme } }, new string[] {} } }); }); #endregion services.For <IConfiguration>().Use(Configuration); services.For <IHttpContextAccessor>().Use <HttpContextAccessor>(); services.AddDbContext <VerticalToDoDbContext>(o => o.UseSqlServer(Configuration.GetConnectionString("VerticalToDo"))); services.SetupRegistries(); var c = new Container(services); var a = c.Model.For <AccountsController>().Default.DescribeBuildPlan(); var q = c.WhatDoIHave(); }
public void fill_service_with_nothing_should_add_the_service() { var registry1 = new FakeRegistryThing(); var services = new ServiceRegistry(); services.SetServiceIfNone(registry1); services.ToGraph().FindAllValues<FakeRegistryThing>().ShouldHaveTheSameElementsAs(registry1); }
public override void Draw(SpriteBatchUI spriteBatch, Point position) { EquipSlots[] slotsToDraw = new EquipSlots[6] { EquipSlots.Body, EquipSlots.Footwear, EquipSlots.Legging, EquipSlots.Shirt, EquipSlots.Hair, EquipSlots.FacialHair }; for (int i = 0; i < slotsToDraw.Length; i++) { int bodyID = 0; int hue = hueSlot(slotsToDraw[i]); bool hueGreyPixelsOnly = true; switch (slotsToDraw[i]) { case EquipSlots.Body: if (m_isElf) { bodyID = (m_isFemale ? 1893 : 1894); } else { bodyID = (m_isFemale ? 1888 : 1889); } break; case EquipSlots.Footwear: bodyID = (m_isFemale ? 1891 : 1890); hue = 900; break; case EquipSlots.Legging: bodyID = (m_isFemale ? 1892 : 1848); hue = 348; break; case EquipSlots.Shirt: bodyID = (m_isFemale ? 1812 : 1849); hue = 792; break; case EquipSlots.Hair: if (equipmentSlot(EquipSlots.Hair) != 0) { bodyID = m_isFemale ? HairStyles.FemaleGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.Hair)) : HairStyles.MaleGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.Hair)); hueGreyPixelsOnly = false; } break; case EquipSlots.FacialHair: if (equipmentSlot(EquipSlots.FacialHair) != 0) { bodyID = m_isFemale ? 0 : HairStyles.FacialHairGumpIDForCharacterCreationFromItemID(equipmentSlot(EquipSlots.FacialHair)); hueGreyPixelsOnly = false; } break; } if (bodyID != 0) { // this is silly, we should be keeping a local copy of the body texture. IResourceProvider provider = ServiceRegistry.GetService <IResourceProvider>(); spriteBatch.Draw2D(provider.GetUITexture(bodyID), new Vector3(position.X, position.Y, 0), Utility.GetHueVector(hue, hueGreyPixelsOnly, false, false)); } } }
public void should_add_object_def_directly() { var registry1 = new FakeRegistryThing(); var services = new ServiceRegistry(); var objectDef = new ObjectDef(typeof (FakeRegistryThing)){ Value = registry1 }; services.AddService(typeof (FakeRegistryThing), objectDef); services.ToGraph().DefaultServiceFor<FakeRegistryThing>().ShouldEqual(objectDef); }
// ====================================================================== // Parse and create boxes // ====================================================================== private BlockElement ParseHtmlToBlocks(string html) { IResourceProvider provider = ServiceRegistry.GetService <IResourceProvider>(); StyleParser styles = new StyleParser(provider); BlockElement root, currentBlock; root = currentBlock = new BlockElement("root", styles.Style); // this is the root! // if this is not HTML, do not parse tags. Otherwise search out and interpret tags. bool parseHTML = true; if (!parseHTML) { for (int i = 0; i < html.Length; i++) { currentBlock.AddAtom(new CharacterElement(styles.Style, html[i])); } } else { HTMLparser parser = new HTMLparser(html); HTMLchunk chunk; while ((chunk = ParseNext(parser)) != null) { if (!(chunk.oHTML == string.Empty)) { // This is a span of text. string text = chunk.oHTML; // make sure to replace escape characters! text = EscapeCharacters.ReplaceEscapeCharacters(text); //Add the characters to the current box for (int i = 0; i < text.Length; i++) { currentBlock.AddAtom(new CharacterElement(styles.Style, text[i])); } } else { // This is a tag. interpret the tag and edit the openTags list. // It may also be an atom, in which case we should add it to the list of atoms! AElement atom = null; if (chunk.bClosure && !chunk.bEndClosure) { styles.CloseOneTag(chunk); if (currentBlock.Tag == chunk.sTag) { currentBlock = currentBlock.Parent; } } else { bool isBlockTag = false; switch (chunk.sTag) { // ====================================================================== // Anchor elements are added to the open tag collection as HREFs. // ====================================================================== case "a": styles.InterpretHREF(chunk, null); break; // ====================================================================== // These html elements are ignored. // ====================================================================== case "body": break; // ====================================================================== // These html elements are blocks but can also have styles // ====================================================================== case "center": case "left": case "right": case "div": atom = new BlockElement(chunk.sTag, styles.Style); styles.ParseTag(chunk, atom); isBlockTag = true; break; // ====================================================================== // These html elements are styles, and are added to the StyleParser. // ====================================================================== case "span": case "font": case "b": case "i": case "u": case "outline": case "big": case "basefont": case "medium": case "small": styles.ParseTag(chunk, null); break; // ====================================================================== // These html elements are added as atoms only. They cannot impart style // onto other atoms. // ====================================================================== case "br": atom = new CharacterElement(styles.Style, '\n'); break; case "gumpimg": // draw a gump image atom = new ImageElement(styles.Style, ImageElement.ImageTypes.UI); styles.ParseTag(chunk, atom); break; case "itemimg": // draw a static image atom = new ImageElement(styles.Style, ImageElement.ImageTypes.Item); styles.ParseTag(chunk, atom); break; // ====================================================================== // Every other element is not interpreted, but rendered as text. Easy! // ====================================================================== default: { string text = html.Substring(chunk.iChunkOffset, chunk.iChunkLength); // make sure to replace escape characters! text = EscapeCharacters.ReplaceEscapeCharacters(text); //Add the characters to the current box for (int i = 0; i < text.Length; i++) { currentBlock.AddAtom(new CharacterElement(styles.Style, text[i])); } } break; } if (atom != null) { currentBlock.AddAtom(atom); if (isBlockTag && !chunk.bEndClosure) { currentBlock = (BlockElement)atom; } } styles.CloseAnySoloTags(); } } } } return(root); }
public void Register(IEnumerable<Type> matchedTypes, ServiceRegistry services) { matchedTypes .Where(t => _pluginType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract) .Each(t => services.AddType(_pluginType, t)); }
internal static void OnDragDrop(ISiteExplorer sender, DragEventArgs e, TreeNodeAdv droppedNode) { //If drop node specified, extract relevant folder, otherwise default to root (Library://) string folderId = StringConstants.RootIdentifier; IServerConnection conn = null; var mgr = ServiceRegistry.GetService <ServerConnectionManager>(); if (droppedNode != null) { var ri = droppedNode.Tag as RepositoryItem; if (ri != null) { if (ri.IsFolder) { folderId = ri.ResourceId; } else { folderId = ri.Parent != null ? ri.Parent.ResourceId : StringConstants.RootIdentifier; } } conn = mgr.GetConnection(ri.ConnectionName); } else { return; } Array a = e.Data.GetData(DataFormats.FileDrop) as Array; bool refresh = false; if (a != null && a.Length > 0) { DragDropHandlerService handlerSvc = ServiceRegistry.GetService <DragDropHandlerService>(); for (int i = 0; i < a.Length; i++) { string file = a.GetValue(i).ToString(); IList <IDragDropHandler> handlers = handlerSvc.GetHandlersForFile(file); if (handlers.Count == 0) { continue; } if (handlers.Count == 1) { using (new WaitCursor(Workbench.Instance)) { if (handlers[0].HandleDrop(conn, file, folderId)) { refresh = true; } } } if (handlers.Count > 1) { //Resolve which handler to use var handler = GenericItemSelectionDialog.SelectItem <IDragDropHandler>(Strings.SelectFileHandler, Strings.SelectFileHandlerDesc, handlers.ToArray()); if (handler != null) { using (new WaitCursor(Workbench.Instance)) { if (handler.HandleDrop(conn, file, folderId)) { refresh = true; } } } } } } if (refresh) { sender.RefreshModel(conn.DisplayName, folderId); } }
public LamarContainerRegistrar(ServiceRegistry registry) { _registry = registry; }
public async Task Run() { Services = new ServiceRegistry(); // Database file provider Services.AddService <IDatabaseFileProviderService>(new DatabaseFileProviderService(new DatabaseFileProvider(ObjectDatabase.CreateDefaultDatabase()))); // Content manager Content = new ContentManager(Services); Services.AddService <IContentManager>(Content); Services.AddService(Content); //Services.AddService<IGraphicsDeviceService>(new GraphicsDeviceServiceLocal(null)); // Game systems var gameSystems = new GameSystemCollection(Services); Services.AddService <IGameSystemCollection>(gameSystems); gameSystems.Initialize(); // Load scene (physics only) var loadSettings = new ContentManagerLoaderSettings { // Ignore all references (Model, etc...) ContentFilter = ContentManagerLoaderSettings.NewContentFilterByType() }; var scene = await Content.LoadAsync <Scene>("MainScene", loadSettings); var sceneInstance = new SceneInstance(Services, scene, ExecutionMode.None); var sceneSystem = new SceneSystem(Services) { SceneInstance = sceneInstance, }; Services.AddService(sceneSystem); var physics = new PhysicsProcessor(); sceneInstance.Processors.Add(physics); var socket = new SimpleSocket(); socket.Connected += clientSocket => { Console.WriteLine("Client connected"); var reader = new BinarySerializationReader(clientSocket.ReadStream); while (true) { // Receive ray start/end var start = reader.Read <Vector3>(); var end = reader.Read <Vector3>(); // Raycast var result = physics.Simulation.Raycast(start, end); Console.WriteLine($"Performing raycast: {(result.Succeeded ? "hit" : "miss")}"); // Send result clientSocket.WriteStream.WriteByte((byte)(result.Succeeded ? 1 : 0)); clientSocket.WriteStream.Flush(); } }; await socket.StartServer(2655, false); Console.WriteLine("Server listening, press a key to exit"); Console.ReadKey(); }
public void Register(ServiceRegistry registry) { registry.Register<IBlock, BlockBase>(BlockType.GetComponent<BlockBase>()); registry.Register<ISpawnService, SpawnService>(); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureContainer(ServiceRegistry services) { services = ConfigureAdditionalServices(services); services.AddCors(options => options.AddPolicy(CorsPolicy, builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .WithExposedHeaders("X-Authorization") )); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); //services.AddSingleton<IAuthorizationHandler, PermissionRequirementHandler>(); services.AddSingleton(provider => Configuration); /*services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) * .AddJwtBearer(options => * { * var authority = $"https://cognito-idp.us-east-1.amazonaws.com/{AWSCognitoSettings.UserPoolId}"; * var audience = AWSCognitoSettings.UserPoolClientId; * * options.Audience = audience; * options.Authority = authority; * options.TokenValidationParameters = new TokenValidationParameters * { * ValidateIssuer = true, * ValidateAudience = false, * ValidateLifetime = true, * ValidateIssuerSigningKey = true, * ValidIssuer = authority, * ValidAudience = audience, * IssuerSigningKey = new CognitoSigningKey(AWSCognitoSettings.UserPoolClientSecret).ComputeKey() * }; * }); * * services.AddAuthorizationCore(options => * { * foreach (var value in EnumExtensions.GetValues<Permissions>()) * { * options.AddPolicy(value.ToString(), policy => policy.Requirements.Add(value.ToRequirement())); * } * * });*/ services.AddControllers(options => { options.Filters.Add(new RequestFilter()); options.Filters.Add(new ResponseFilter()); options.Filters.Add(new CustomExceptionFilter(services.BuildServiceProvider().GetService <ILogger <CustomExceptionFilter> >())); options.ModelBinderProviders.Insert(0, new DateTimeModelBinderProvider()); }) .AddNewtonsoftJson(x => { x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; x.SerializerSettings.Converters.Add(new CustomStringToEnumConverter()); x.SerializerSettings.Converters.Add(new DateTimeConverter()); }); services.AddSwaggerGen(c => { CreateSwaggerGenOptions(c, Assembly.GetEntryAssembly()); var xmlFile = $"{Assembly.GetEntryAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); if (xmlPath != null && File.Exists(xmlPath)) { c.IncludeXmlComments(xmlPath); } }); services.AddSwaggerGenNewtonsoftSupport(); }
public void Benchmark() { const int TestCount = 5; const int TestEntityCount = 10000; long totalTime = 0; long stepTime = 0; var clock = Stopwatch.StartNew(); Console.WriteLine($"Test1 -> [Add {TestEntityCount} entities + 10 custom components] x {TestCount} times"); Console.WriteLine($"Test2 -> [Add {TestEntityCount} entities], [Add 10 custom component, Remove 10 custom component] x {TestCount} times)"); DumpGC($"Start Test1 - "); for (int j = 0; j < TestCount; j++) { var registry = new ServiceRegistry(); var entityManager = new CustomEntityManager(registry); clock.Restart(); for (int i = 0; i < TestEntityCount; i++) { var entity = new Entity { new BenchComponent1(), new BenchComponent2(), new BenchComponent3(), new BenchComponent4(), new BenchComponent5(), new BenchComponent6(), new BenchComponent7(), new BenchComponent8(), new BenchComponent9(), new BenchComponent10(), }; entityManager.Add(entity); } var elapsed = clock.ElapsedMilliseconds; stepTime += elapsed; DumpGC($"\t[{j}] Elapsed: {elapsed}ms "); } DumpGC($"End - Elapsed {stepTime}ms "); totalTime += stepTime; stepTime = 0; Console.WriteLine(); DumpGC($"Start Test2 - "); { var registry = new ServiceRegistry(); var entityManager = new CustomEntityManager(registry); for (int i = 0; i < TestEntityCount; i++) { var entity = new Entity(); entityManager.Add(entity); } for (int j = 0; j < TestCount; j++) { clock.Restart(); foreach (var entity in entityManager) { entity.Add(new BenchComponent1()); entity.Add(new BenchComponent2()); entity.Add(new BenchComponent3()); entity.Add(new BenchComponent4()); entity.Add(new BenchComponent5()); entity.Add(new BenchComponent6()); entity.Add(new BenchComponent7()); entity.Add(new BenchComponent8()); entity.Add(new BenchComponent9()); entity.Add(new BenchComponent10()); } var elapsedAdd = clock.ElapsedMilliseconds; stepTime += elapsedAdd; clock.Restart(); foreach (var entity in entityManager) { entity.Remove <BenchComponent1>(); entity.Remove <BenchComponent2>(); entity.Remove <BenchComponent3>(); entity.Remove <BenchComponent4>(); entity.Remove <BenchComponent5>(); entity.Remove <BenchComponent6>(); entity.Remove <BenchComponent7>(); entity.Remove <BenchComponent8>(); entity.Remove <BenchComponent9>(); entity.Remove <BenchComponent10>(); } var elapsedRemove = clock.ElapsedMilliseconds; stepTime += elapsedRemove; DumpGC($"\t[{j}] ElapsedAdd: {elapsedAdd} ElapsedRemove: {elapsedRemove} "); } } DumpGC($"End - Elapsed {stepTime}ms "); totalTime += stepTime; // Only perform this assert on Windows if (Platform.Type == PlatformType.Windows) { Assert.True(totalTime < 3000, "This test should run in less than 3000ms"); } Console.WriteLine($"Total Time: {totalTime}ms"); }
public AssemblyScanner(ServiceRegistry parent) { _parent = parent; Exclude(type => type.HasAttribute <LamarIgnoreAttribute>()); }
public void replace_service_by_specifying_a_value() { var graph = new BehaviorGraph(); var resolver = MockRepository.GenerateMock<IObjectResolver>(); var services = new ServiceRegistry(); services.ReplaceService(resolver); services.As<IConfigurationAction>().Configure(graph); graph.Services.DefaultServiceFor<IObjectResolver>().Value.ShouldBeTheSameAs(resolver); }
/// <summary> /// Registers the InMemory saga repository for all saga types (generic, can be overridden) /// </summary> /// <param name="registry"></param> public static void RegisterInMemorySagaRepository(this ServiceRegistry registry) { registry.AddSingleton(typeof(ISagaRepository <>), typeof(InMemorySagaRepository <>)); }
public void should_add_object_def_directly() { var registry1 = new HtmlConventionRegistry(); var services = new ServiceRegistry(); var objectDef = new ObjectDef(typeof (HtmlConventionRegistry)){ Value = registry1 }; services.AddService(typeof (HtmlConventionRegistry), objectDef); services.ToGraph().DefaultServiceFor<HtmlConventionRegistry>().ShouldEqual(objectDef); }
/// <summary> /// Register the InMemory saga repository for the specified saga type /// </summary> /// <param name="registry"></param> /// <typeparam name="T"></typeparam> public static void RegisterInMemorySagaRepository <T>(this ServiceRegistry registry) where T : class, ISaga { registry.AddSingleton <ISagaRepository <T>, InMemorySagaRepository <T> >(); }