コード例 #1
0
        private static void AddIoCBindings()
        {
            var treeSqlOption = new Grit.Tree.Repository.MySql.SqlOption
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["Tree.MySql"].ConnectionString,
                Table            = "tree"
            };

            NinjectContainer.Bind <ITreeRepository>().To <TreeRepository>().InSingletonScope()
            .WithConstructorArgument <Grit.Tree.Repository.MySql.SqlOption>(treeSqlOption);
            NinjectContainer.Bind <ITreeService>().To <TreeService>().InSingletonScope();
        }
コード例 #2
0
ファイル: BootStrapper.cs プロジェクト: hotjk/dotconfig
        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();
        }
コード例 #3
0
ファイル: BaseRepository.cs プロジェクト: hotjk/dotconfig
 public BaseRepository(SqlOption option)
 {
     this.ConnectionString = option.ConnectionString;
 }
コード例 #4
0
 public TreeRepository(SqlOption option) : base(option)
 {
 }
コード例 #5
0
 public BaseRepository(SqlOption option)
 {
     Option = option;
 }