예제 #1
0
        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            var config = MembershipRebootConfig.Create();

            kernel.Bind <MembershipRebootConfiguration <CustomUserAccount> >().ToConstant(config);
            kernel.Bind <IUserAccountRepository <CustomUserAccount> >().To <CustomRepository>().InRequestScope();
            kernel.Bind <CustomDatabase>().ToSelf().InRequestScope();
            kernel.Bind <IUserAccountQuery>().To <CustomRepository>().InRequestScope();
            kernel.Bind <AuthenticationService <CustomUserAccount> >().To <SamAuthenticationService <CustomUserAccount> >();
        }
        public DefaultRegistry()
        {
            Scan(
                scan => {
                scan.TheCallingAssembly();
                scan.WithDefaultConventions();
                scan.With(new ControllerConvention());
            });

            var docStore = GetRavenDbDocumentStore();

            PassiveSessionConfiguration.ConfigureSessionCache(new RavenDbTokenCacheRepository(docStore));

            var config = MembershipRebootConfig.Create();

            config.RequireAccountVerification = false;
            For <MembershipRebootConfiguration <HierarchicalUserAccount> >().Use(config);

            For <IDocumentStore>().Use(docStore);
            For <UserAccountService <HierarchicalUserAccount> >().Use <UserAccountService <HierarchicalUserAccount> >();
            For <AuthenticationService <HierarchicalUserAccount> >().Use <SamAuthenticationService <HierarchicalUserAccount> >();
            For <IUserAccountQuery>().HybridHttpOrThreadLocalScoped().Use <RavenUserAccountRepository>();
            For <IUserAccountRepository <HierarchicalUserAccount> >().HybridHttpOrThreadLocalScoped().Use <RavenUserAccountRepository>();
        }