protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); container.Register<Repositories.IAppUserMapper, Repositories.InMemoryAppUserMapper>().AsSingleton(); container.Register<IUserMapper>(container.Resolve<Repositories.IAppUserMapper>()); }
// Overriding this just to show how it works, not actually necessary as autoregister // takes care of it all. protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer existingContainer) { // We don't call base because we don't want autoregister // we just register our one known dependency as an application level singleton existingContainer.Register<IApplicationDependency, ApplicationDependencyClass>().AsSingleton(); existingContainer.Register<IRazorConfiguration, MyRazorConfiguration>().AsSingleton(); }
public static void ProcessRegistrations(TinyIoC.TinyIoCContainer container) { var applicationRegistrationImplementations = AppDomain.CurrentDomain.GetAssemblies() .Where(a => a.GetReferencedAssemblies().Contains(typeof (ApplicationRegistar).Assembly.GetName()) || a == typeof (ApplicationRegistar).Assembly) .SelectMany(t => t.GetTypes()) .Where(t => t.Implements(typeof (IApplicationRegistration))) .ToList(); container.RegisterMultiple<IApplicationRegistration>(applicationRegistrationImplementations); var applicationRegistrations = container.ResolveAll<IApplicationRegistration>().ToList(); foreach (var typeRegistration in applicationRegistrations.SelectMany(ar => ar.TypeRegistrations)) { container.Register(typeRegistration.RegistrationType, typeRegistration.InstanceType); } foreach (var instanceRegistration in applicationRegistrations.SelectMany(ar => ar.InstanceRegistrations)) { container.Register(instanceRegistration.RegistrationType, instanceRegistration.Instance); } foreach (var collectionRegistration in applicationRegistrations.SelectMany(ar => ar.CollectionRegistration).GroupBy(cr => cr.RegistrationType)) { container.RegisterMultiple(collectionRegistration.Key, collectionRegistration.SelectMany(c => c.InstanceTypes)); } }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); container.Register<IRaceData>(new RaceData(_args.AlwaysUseCache)); container.Register<IOutput, CliOutput>(); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { container.Register(documentStore); container.Register(s3Configuration); container.Register<IS3Storage, RavenDBStorage>().AsSingleton(); container.Register<IS3Responder, S3XmlResponder>().AsSingleton(); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); container.Register(typeof(NameValueCollection), ConfigurationManager.AppSettings); DocumentStoreContainer.Initialize(); container.Register(DocumentStoreContainer.Instance); container.Register((ioc, _) => ioc.Resolve<IDocumentStore>().OpenSession()); }
/// <summary> /// Configures dependencies into the dependency container /// </summary> /// <param name="container"></param> internal static void Configure(TinyIoC.TinyIoCContainer container) { container.Register<IMessageTypeResolver, DefaultMessageTypeResolver>(); container.Register<MessageEventDispatcher>().AsSingleton(); container.Register<IMessageSerializerFactory, JsonMessageSerializerFactory>(); container.Register<IMessageDeserializerFactory, JsonMessageDeserializerFactory>(); }
public override void ConfigureRequestContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureRequestContainer(container); RequestContainerConfigured = true; container.Register<IFoo, Foo>().AsSingleton(); container.Register<IDependency, Dependency>().AsSingleton(); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { container.Register<IPersistentStore, PersistentStore>().AsSingleton(); var bus = StickABusInIt(container.Resolve<IPersistentStore>()); container.Register<ICommandSender, FakeBus>(bus); container.Register<IEventPublisher, FakeBus>(bus); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { var mefcontainer = CreateCompositionContainer(); container.Register(mefcontainer.GetExportedValues<IAnnounce>()); container.Register(mefcontainer.GetExportedValues<ISprocketInitializer>()); container.Register(new SprocketManager(mefcontainer.GetExportedValues<ISprocket>())); container.Register(new Bot(_serverUrl, _botName, _botPassword)); }
protected override void ConfigureRequestContainer(TinyIoC.TinyIoCContainer container, NancyContext context) { base.ConfigureRequestContainer(container, context); container.Register< BlogService>(); var ravenSession = container.Resolve< IRavenSessionProvider >().GetSession(); container.Register( ravenSession ); container.Register< IBlogService, BlogService >(); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); var mongoUrlStore = new MongoUrlStore("mongodb://localhost:27010/short_url"); container.Register<UrlStore>(mongoUrlStore); }
protected override void ConfigureRequestContainer(TinyIoC.TinyIoCContainer container) { foreach (var mock in _mocks) { container.Register(mock.Key, mock.Value); } }
protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container) { base.InitialiseInternal(container); var configuration = new StitchConfiguration() { /*Compilers = new[] { new StitchConfigurationCompiler {Type = typeof (JavaScriptCompiler).AssemblyQualifiedName, Extension = ".js"}, new StitchConfigurationCompiler {Type = typeof (CoffeeScriptCompiler).AssemblyQualifiedName, Extension = ".coffee"}, new StitchConfigurationCompiler {Type = typeof (jQueryTemplateCompiler).AssemblyQualifiedName, Extension = ".tmpl"} },*/ Files = new[] { new StitchConfiguration() { Name = "/Scripts/app.stitch", Paths = new[] { "Scripts/App" } } } }; container.Register<IStitchConfiguration>(configuration); Stitch.Enable(this, container.Resolve<IRootPathProvider>(), container.Resolve<IStitchConfiguration>()); }
protected override void ConfigureRequestContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureRequestContainer(container); // Here we register our user mapper as a per-request singleton. // As this is now per-request we could inject a request scoped // database "context" or other request scoped services. container.Register<IUserMapper, UserDatabase>(); }
private void RegisterFacebookClientPerRequest(TinyIoC.TinyIoCContainer container, NancyContext context) { var facebookClient = new Facebook.FacebookClient(); if (context.Request != null && context.Request.Url != null) facebookClient.IsSecureConnection = context.Request.Url.Scheme == "https"; container.Register(facebookClient); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); var connectionString = ConfigurationManager.ConnectionStrings["DoublewideConnection"].ConnectionString; container.Register<IDbConnectionFactory>( (c, p) => new OrmLiteConnectionFactory(connectionString, SqlServerOrmLiteDialectProvider.Instance)); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); container.Register<IDbContextFactory, DbContextFactory<HotelAdminContext>>(); container.Register<IDbSetProvider, AspNetObjectContextAdapter>().AsMultiInstance(); container.Register<IObjectContext, AspNetObjectContextAdapter>().AsMultiInstance(); container.Register<IHotelRepository, HotelRepository>().AsMultiInstance(); container.Register<IFactTypeRepository, FactTypeRepository>().AsMultiInstance(); container.Register<IHistoryItemRepository, DummyHistoryItemRepository>().AsMultiInstance(); container.Register<IHotelService, HotelService>().AsMultiInstance(); container.Register<IFactTypeService, FactTypeService>().AsMultiInstance(); }
protected override void RegisterInstances(TinyIoC.TinyIoCContainer container, IEnumerable<Nancy.Bootstrapper.InstanceRegistration> instanceRegistrations) { base.RegisterInstances(container, instanceRegistrations); var settings = new NodeTreeCms.Cms.NodeTreeCmsSettings() { DbPath = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/NodeTreeCmsLiveDb"), AdminUrl = "/admin", DefaultViewPath = "Views/Default.cshtml" }; var cms = new Cms(settings); container.Register<ICms, Cms>(cms); }
protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); DataAnnotationsValidator.RegisterAdapter(typeof(MatchAttribute), (v, d) => new CustomDataAdapter((MatchAttribute)v)); Func<TinyIoCContainer, NamedParameterOverloads, IDocumentSession> factory = (ioccontainer, namedparams) => { return new RavenSessionProvider().GetSession(); }; container.Register<IDocumentSession>(factory); container.Register<IUserMapper, UserMapper>(); Raven.Client.Indexes.IndexCreation.CreateIndexes(typeof(IndexEventDate).Assembly, RavenSessionProvider.DocumentStore); Raven.Client.Indexes.IndexCreation.CreateIndexes(typeof(IndexUserLoginType).Assembly, RavenSessionProvider.DocumentStore); Raven.Client.Indexes.IndexCreation.CreateIndexes(typeof(IndexMostPopularDinners).Assembly, RavenSessionProvider.DocumentStore); Raven.Client.Indexes.IndexCreation.CreateIndexes(typeof(IndexMyDinners).Assembly, RavenSessionProvider.DocumentStore); pipelines.OnError += (context, exception) => { Elmah.ErrorSignal.FromCurrentContext().Raise(exception); return null; }; }
// Overriding this just to show how it works, not actually necessary as autoregister // takes care of it all. protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { // We don't call base because we don't want autoregister // we just register our one known dependency as an application level singleton container.Register<IApplicationDependency, ApplicationDependencyClass>().AsSingleton(); //This changes come from Pull Request #57 container.RegisterMultiple<IViewEngineRegistry>(new[] { //typeof (SparkViewRegistry), typeof (RazorViewRegistry), typeof (NDjangoViewRegistry) }).AsSingleton(); }
protected override void ConfigureApplicationContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureApplicationContainer(container); //try to register the command handlers container.Register<IAmACommandProcessor, CommandProcessor>(); container.Register<IAdaptAnInversionOfControlContainer, TinyIoCAdapter>(); container.Register<IHandleRequests<AddTaskCommand>, AddTaskCommandHandler>().AsMultiInstance(); container.Register<ITaskListRetriever, TaskListRetriever>().AsMultiInstance(); container.Register<ITasksDAO, TasksDAO>().AsMultiInstance(); container.Register<ITraceOutput, ConsoleTrace>().AsSingleton(); }
protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); // DataAnnotationsValidator.RegisterAdapter(typeof(MatchAttribute), (v, d) => new CustomDataAdapter((MatchAttribute)v)); Func<TinyIoCContainer, NamedParameterOverloads, IDocumentSession> factory = (ioccontainer, namedparams) => { return new RavenSessionProvider().GetSession(); }; container.Register<IDocumentSession>(factory); CleanUpDB(container.Resolve<IDocumentSession>()); //Raven.Client.Indexes.IndexCreation.CreateIndexes(typeof(Dinners_Index).Assembly, RavenSessionProvider.DocumentStore); //pipelines.OnError += (context, exception) => //{ // Elmah.ErrorSignal.FromCurrentContext().Raise(exception); // return null; //}; }
protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); var documentStore = new EmbeddableDocumentStore { DataDirectory = "Data" }; documentStore.Configuration.DefaultStorageTypeName = "munin"; documentStore.Initialize(); container.Register<IDocumentStore>(documentStore); container.Register<IDocumentSession>((c, o) => c.Resolve<IDocumentStore>().OpenSession()); container.Register<IObjectMapper, ObjectMapper>().AsSingleton(); container.Register<IHasher, Sha256Hasher>().AsSingleton(); container.Register<IEnvironment, Environment>().AsSingleton(); container.RegisterMultiple<IDeploymentStep>(new [] { typeof(DownloadPackageStep), typeof(UnpackPackageStep), typeof(DeployApplicationStep) }).AsMultiInstance(); container.Register<IDeploymentPipeline, DeploymentPipeline>().AsMultiInstance(); container.Register<IDeploymentWatcher, DeploymentWatcher>(); container.Register<IWebClient, WebClient>(); container.Resolve<IDeploymentWatcher>().Start(); }
private void ConfigureFacebookRequestContainer(TinyIoC.TinyIoCContainer container, NancyContext context) { var fb = new FacebookClient(); if (context.Request != null) { fb.IsSecureConnection = context.Request.Url.Scheme == "https"; if (!string.IsNullOrWhiteSpace(context.Request.Headers.Referrer)) fb.UseFacebookBeta = new Uri(context.Request.Headers.Referrer).Host == "apps.beta.facebook.com"; } container.Register(fb); container.Register<IFacebookApplication>( (c, o) => new DefaultFacebookApplication { AppId = ", AppSecret = ", //SiteUrl = "http://localhost:10537/", CanvasUrl = "http://localhost:10537/", SecureCanvasUrl = "https://localhost:44300/", CanvasPage = "http://apps.facebook.com/ }); }
protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container) { base.InitialiseInternal(container); var configuration = new StitchConfiguration() { Files = new[] { new StitchConfiguration() { Name = "/Scripts/app.stitch", Paths = new[] { "Scripts/App" } } } }; container.Register<IStitchConfiguration>(configuration); Stitch.Enable(this, container.Resolve<IRootPathProvider>(), container.Resolve<IStitchConfiguration>()); }
protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, IPipelines pipeline) { container.Register<IAccountService, AccountService>().AsSingleton(); base.ApplicationStartup(container, pipeline); pipeline.EnableBasicAuthentication(new BasicAuthenticationConfiguration(container.Resolve<IUserValidator>(),"AgbaraVOIP")); }
public override void Register <T1, T2>() { _ioc.Register <T1, T2>(); }
protected override void ConfigureRequestContainer(TinyIoC.TinyIoCContainer container) { base.ConfigureRequestContainer(container); container.Register<IUserMapper, UserMapper>(); }
protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container) { base.InitialiseInternal(container); container.Register<IRazorConfiguration, CustomRazorConfiguration>(); }
public override void ConfigureRequestContainer(TinyIoC.TinyIoCContainer existingContainer) { base.ConfigureRequestContainer(existingContainer); existingContainer.Register<IRequestDependency, RequestDependencyClass>().AsSingleton(); }