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(); }
public BaseRepository(SqlOption option) { this.ConnectionString = option.ConnectionString; }
public SqlRepository(SqlOption option) : base(option) { }
public NodeRepository(SqlOption option) : base(option) { }
public ClientRepository(SqlOption option) : base(option) { }
public UserRepository(SqlOption option) : base(option) { }