Exemplo n.º 1
0
        private static void AddIoCBindings()
        {
            var settingsSqlOption = new Settings.Repository.MySql.SqlOption {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySql"].ConnectionString
            };
            var treeSqlOption = new Grit.Tree.Repository.MySql.SqlOption {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySql"].ConnectionString
            };
            var sequenceSqlOption = new Grit.Sequence.Repository.MySql.SqlOption {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySql"].ConnectionString
            };

            NinjectContainer.Bind <ISequenceRepository>().To <SequenceRepository>().InSingletonScope()
            .WithConstructorArgument <Grit.Sequence.Repository.MySql.SqlOption>(sequenceSqlOption);
            NinjectContainer.Bind <ISequenceService>().To <SequenceService>().InSingletonScope();

            NinjectContainer.Bind <ITreeRepository>().To <TreeRepository>().InSingletonScope()
            .WithConstructorArgument <Grit.Tree.Repository.MySql.SqlOption>(treeSqlOption);
            NinjectContainer.Bind <ITreeService>().To <TreeService>().InSingletonScope()
            .WithConstructorArgument("table", "settings_tree");

            NinjectContainer.Bind <INodeRepository>().To <NodeRepository>().InSingletonScope()
            .WithConstructorArgument <Settings.Repository.MySql.SqlOption>(settingsSqlOption);
            NinjectContainer.Bind <INodeService>().To <NodeService>().InSingletonScope();

            NinjectContainer.Bind <IClientRepository>().To <ClientRepository>().InSingletonScope()
            .WithConstructorArgument <Settings.Repository.MySql.SqlOption>(settingsSqlOption);
            NinjectContainer.Bind <IClientService>().To <ClientService>().InSingletonScope();

            NinjectContainer.Bind <IUserRepository>().To <UserRepository>().InSingletonScope()
            .WithConstructorArgument <Settings.Repository.MySql.SqlOption>(settingsSqlOption);
            NinjectContainer.Bind <IUserService>().To <UserService>().InSingletonScope();

            NinjectContainer.Bind <ISqlRepository>().To <SqlRepository>().InSingletonScope()
            .WithConstructorArgument <Settings.Repository.MySql.SqlOption>(settingsSqlOption);
            NinjectContainer.Bind <ISqlService>().To <SqlService>().InSingletonScope();
        }
Exemplo n.º 2
0
 public SequenceRepository(SqlOption option) : base(option)
 {
 }
Exemplo n.º 3
0
 public BaseRepository(SqlOption option)
 {
     this.ConnectionString = option.ConnectionString;
 }