Пример #1
0
 internal PartitionedViewAdapter(PartitionedViewConfiguration <T> config, MemberTableFactory <T> memberTableFactory, DatabaseAdapter adapter)
     : base(config.ConnectionName)
 {
     Config             = config;
     Adapter            = adapter;
     MemberTableFactory = memberTableFactory;
     memberTables       = GetDataRangeKeys().Select(MemberTableFactory.Create).ToList();
 }
Пример #2
0
 public MemberTableDbContext(string suffix, PartitionedViewConfiguration config)
     : base(config.ConnectionName)
 {
     PartitionDataRange           = suffix;
     PrimaryKeyPropertyNames      = config.PrimaryKeyPropertyNames;
     PartitionedViewConfiguration = config;
     Database.SetInitializer(new MigrateDatabaseToLatestVersion <MemberTableDbContext <T>, Configuration <T> >(true));
 }
Пример #3
0
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.RegisterEntityType(DataType);
            modelBuilder.Types()
            .Where(t => t == DataType)
            .Configure(c => c.HasKey(PrimaryKeyPropertyNames));

            PartitionedViewConfiguration.OnModelCreating(modelBuilder);

            base.OnModelCreating(modelBuilder);
        }
Пример #4
0
 public MemberTableFactory(PartitionedViewConfiguration <T> config)
 {
     Config = config;
 }
 public virtual MemberTableFactory <T> CreateMemberTableFactory <T>(PartitionedViewConfiguration <T> config)
 {
     return(new MemberTableFactory <T>(config));
 }
 public virtual PartitionedViewAdapter <T> Create <T>(PartitionedViewConfiguration <T> config) where T : class
 {
     return(new PartitionedViewAdapter <T>(config, CreateMemberTableFactory(config), CreateDatabaseAdapter(config.ConnectionName)));
 }