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(); }
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 TreeRepository(SqlOption option) : base(option) { }
public BaseRepository(SqlOption option) { Option = option; }