Exemplo n.º 1
0
 protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
 {
     container.Register<InMemoryDatabase>().AsSingleton();
     container.Register<IMediator>(new Mediator(container.Resolve, container.ResolveAll));
     container.Register<IAsyncRequestHandler<SellInventory, Unit>, SellInventoryHandler>();
     container.Register<IAsyncRequestHandler<GetInventoryItem, InventoryItem>, GetInventoryItemHandler>();
 }
Exemplo n.º 2
0
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            container.Register<IPackageService>(_testFixture.PackageService);
            container.Register<IGlobalSettingsService>(_testFixture.GlobalSettingsService);
        }
 protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
 {
     base.ConfigureApplicationContainer(container);
     container.Register<IBrightstarService>(_brightstarService);
     container.Register<AbstractStorePermissionsProvider>(_storePermissionsProvider);
     container.Register(_systemPermissionsProvider);
 }
 protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
 {
     base.ConfigureApplicationContainer(container);
     container.Register(_brightstarService);
     container.Register(_storePermissionsProvider);
     container.Register(_systemPermissionsProvider);
     container.Register<RazorViewEngine>();
 }
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            // Register the repo for the whole application
            container.Register(_repo);
            container.Register(_md);
        }
Exemplo n.º 6
0
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            Wiring.Wire();
            base.ApplicationStartup(container, pipelines);

            container.Register<IProductRepository, ProductRepository>().AsSingleton();
            container.Register<IProductService, ProductService>().AsSingleton();
            container.Register<IProductLogic, ProductLogic>().AsSingleton();
        }
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            container.Register<ISettingsProvider, WebSettingsProvider>();
            container.Register<ILoginProvider, LoginProvider>();
            container.Register<ILandingProvider, LandingProvider>();

            container.Register<IUserService, UserService>();
            container.Register<IUserMapper>(container.Resolve<IUserService>());
        }
Exemplo n.º 8
0
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            // register custom json serializer, camelCase in this case
            container.Register(typeof(JsonSerializer), typeof(CustomJsonSerializer));
        }
Exemplo n.º 9
0
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            var mediator = new Mediator();

            //            mediator.Register<IHandleQueries<IQuery<User>, User>>(delegate
            //                {
            //                    return new UserQueryHandler();
            //                });
            //
            //            mediator.Register<ICommandHandler<ICommand<int>, int>>(delegate
            //                {
            //                    return new InsertUserCommandHandler();
            //                }
            //            );

            mediator.Register<IHandleQueries<IQuery<User>,User>, UserQueryHandler>();

            mediator.Register<ICommandHandler<ICommand<int>,int>,UpdateUserCommandHandler>();
            mediator.Register<ICommandHandler<ICommand<int>,int>,InsertUserCommandHandler>();

            //            mediator.Register<ICommandHandler<ICommand<int>, int>>(delegate
            //                {
            //                    return new UpdateUserCommandHandler();
            //                }
            //            );

            container.Register<IMediate,Mediator>(mediator);
        }
Exemplo n.º 10
0
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) {
            // Setup IoC
            container.Register<IDataStore>(new kernetics.messenger.database.DataStore());
            //container.Register<IUserMapper>();

            // TODO: Setup authentication
            //var formsAuthConfiguration = new Nancy.Authentication.Forms.FormsAuthenticationConfiguration() {
            //    RedirectUrl = "~/login",
            //    UserMapper = container.Resolve<IUserMapper>(),
            //};
            //Nancy.Authentication.Forms.FormsAuthentication.Enable(pipelines, formsAuthConfiguration);

            // Error handling
            pipelines.OnError += (context, exception) => {
                if (exception is Exception) {
                    return new Response() {
                        StatusCode = HttpStatusCode.NotFound,
                        ContentType = "text/html",
                        Contents = (stream) => {
                            var errorMessage = Encoding.UTF8.GetBytes(exception.Message);
                            stream.Write(errorMessage, 0, errorMessage.Length);
                        }
                    };
                }

                Console.WriteLine("Error");
                return null;
            };

            base.ApplicationStartup(container, pipelines);
        }
Exemplo n.º 11
0
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            StaticConfiguration.DisableErrorTraces = false;

            container.Register<IMobileWebClient>(new MobileWebClient());

            base.ApplicationStartup(container, pipelines);
        }
Exemplo n.º 12
0
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["data"];
            var providerFactory = new SQLiteFactory();
            var repository = new Repository(providerFactory, connectionString.ConnectionString);
            container.Register(typeof(IRepository), repository);

            base.ApplicationStartup(container, pipelines);
        }
Exemplo n.º 13
0
        protected override void ConfigureRequestContainer(Nancy.TinyIoc.TinyIoCContainer container, NancyContext context)
        {
            base.ConfigureRequestContainer(container, context);

            var docStore = container.Resolve<IDocumentStore>();
            var docSession = docStore.OpenSession();
            container.Register(docSession);
            context.Items.Add("RavenSession", docSession);
        }
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);
            container.Register(SqlServerConfiguration.ReadAppSettings());
            var sqlExecutor = container.Resolve<SqlExecutor>();
            container.Register(SqlSelectCourse.Load(sqlExecutor));
            container.Register<ILogger>(Logger.CreateFromConfiguration());
            

            var assembly = GetType().Assembly;
            if (!s_ViewSetupCompleted)
            {
                ResourceViewLocationProvider
                    .RootNamespaces
                    .Add(assembly, "RedGate.Publishing.InteractiveSql.Web.Views");
                s_ViewSetupCompleted = true;
            }
        }
Exemplo n.º 15
0
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            container.Register<AppInfo>(new AppInfo
            {
                Version = Assembly.GetExecutingAssembly().GetName().Version.ToString()
            });
        }
Exemplo n.º 16
0
        // The bootstrapper enables you to reconfigure the composition of the framework,
        // by overriding the various methods and properties.
        // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            var projectRoot = AppDomain.CurrentDomain.BaseDirectory;
            var projectService = new MainProjectService(projectRoot);
            container.Register<IProjectService>(projectService);

            AppDomainAssemblyTypeScanner.AddAssembliesToScan("KissCI.dll");
        }
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            JsConfig.EmitCamelCaseNames = true;
            JsConfig.DateHandler = JsonDateHandler.ISO8601;
            JsConfig.IncludeNullValues = false;

            container.Register<ISerializer>(new ServiceStackJsonSerializer());
        }
Exemplo n.º 18
0
 protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
 {
     base.ApplicationStartup(container, pipelines);
     container.Register<ITokenizer>(new Tokenizer((config) =>
     {
         config.AdditionalItems();
         config.KeyExpiration(() => new TimeSpan(DateTime.MaxValue.Ticks));
         config.TokenExpiration(() => new TimeSpan(DateTime.MaxValue.AddDays(-1).Ticks));
         config.WithKeyCache(new DBTokenKeyStore(ConfigurationManager.AppSettings["tokenDbConnection"]));
     }));
 }
Exemplo n.º 19
0
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);
            container.Register<INTodoService>(new NTodoService());

            pipelines.OnError += (ctx, err) =>
            {
                ctx.Trace.TraceLog.WriteLog((s) => { s.AppendLine("エラーが発生:" + err.Message); });
                //本当はエラーページのViewなどを返す。
                return err.Message;
            };
        }
Exemplo n.º 20
0
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            var store = new DocumentStore
                            {
                                ConnectionStringName = "RavenDB"
                            };

            store.Initialize();
            container.Register<IDocumentStore>(store);
        }
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            JsConfig.EmitCamelCaseNames = true;
            JsConfig.DateHandler = JsonDateHandler.ISO8601;
            JsConfig.IncludeNullValues = false;

            var pathProvider = container.Resolve<IRootPathProvider>();
            var travelRepoJsonPath = Path.Combine(pathProvider.GetRootPath(), "Resources", "offers.json");

            var travelRepo = new TravelOffersRepository(travelRepoJsonPath);

            container.Register<ITravelOffersRepository>(travelRepo);
        }
Exemplo n.º 22
0
        // The bootstrapper enables you to reconfigure the composition of the framework,
        // by overriding the various methods and properties.
        // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper
        protected override void ConfigureRequestContainer(Nancy.TinyIoc.TinyIoCContainer container, NancyContext context)
        {
            base.ConfigureRequestContainer(container, context);

            var githubAuth = new GitHubProvider(new ProviderParams() {
                PublicApiKey = Environment.GetEnvironmentVariable("PEASANT_OAUTH_ID") ?? "68e704a8ede918f8d940",
                SecretApiKey = Environment.GetEnvironmentVariable("PEASANT_OAUTH_KEY") ?? "888b305d22b2d7251b087c5903be21f7eaca4e20",
                Scopes = new[] { "repo", "user", "status", }
            });

            var authServiceFactory = new AuthenticationProviderFactory();
            authServiceFactory.AddProvider(githubAuth);

            container.Register<IAuthenticationCallbackProvider>(new AuthenticationCallbackProvider());

            BlobCache.ApplicationName = "Peasant";
        }
Exemplo n.º 23
0
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            container.Register<OpenTokService>().AsSingleton();
        }
        protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            container.Register(typeof(IFileSystem), Substitute.For<IFileSystem>());
        }
 protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
 {
     container.Register<ICustomerRepository, RavenCustomerRepository>().AsSingleton();
 }
Exemplo n.º 26
0
        /// <summary>
        ///     Configures the container using AutoRegister followed by registration of default INancyModuleCatalog and IRouteResolver.
        /// </summary>
        /// <param name="container">Instance of the IoC container used for the instance.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="container"/> is <c>null</c>.</exception>
        protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            base.ConfigureApplicationContainer(container);

            container.Register(_host);
        }
Exemplo n.º 27
0
 protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
 {
     container.Register<IFieldNameConverter, TitleCaseFieldNameConverter>();
     base.ApplicationStartup(container, pipelines);
 }
Exemplo n.º 28
0
        protected override void RegisterInstances(Nancy.TinyIoc.TinyIoCContainer container, System.Collections.Generic.IEnumerable<Nancy.Bootstrapper.InstanceRegistration> instanceRegistrations)
        {
            base.RegisterInstances(container, instanceRegistrations);

            container.Register<IAppRepository, AppRepository>();
        }
 protected override void ConfigureApplicationContainer(Nancy.TinyIoc.TinyIoCContainer container)
 {
     base.ConfigureApplicationContainer(container);
     container.Register<Commander>(new Commander());
 }
Exemplo n.º 30
0
 protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
 {
     StaticConfiguration.DisableErrorTraces = false;
     container.Register<IKernel> (kernel);
 }