private string GetTemporalTableSqlDependingOnIfTableIsTemporalOrNot <TEntity>(
            ITableHelper <FakeDataContext> tableHelper,
            params Type[] entityTypesToCreateTemporalTablesFor) where TEntity : class
        {
            var options = DbContextOptionsSetup.Setup <FakeDataContext>();

            using (var context = new FakeDataContext(options))
            {
                // Register entity types to support temporal tables.
                entityTypesToCreateTemporalTablesFor
                ?.ToList()
                ?.ForEach(e => TemporalEntitiesCache.Add(context.Model.FindEntityType(e)));

                var entityType = context.Model.FindEntityType(typeof(TEntity));

                var temporalTableSqlBuilder = new TemporalTableSqlBuilder <FakeDataContext>(
                    context,
                    new TemporalTableSqlGeneratorFactory(),
                    tableHelper);

                string sql = temporalTableSqlBuilder.BuildTemporalTablesSqlForEntityTypes(new[] { entityType });

                return(sql);
            }
        }
コード例 #2
0
 public RegistrationService(
     TableHelperRegistry tableHelperRegistry,
     IAccountService accountService)
 {
     _accountService     = accountService;
     _accountTableHelper = tableHelperRegistry.TableHelpers[Table.Accounts];
 }
 public TemporalTableSqlBuilder(
     TContext context,
     ITemporalTableSqlGeneratorFactory temporalTableSqlGeneratorFactory,
     ITableHelper <TContext> tableHelper)
 {
     this.context = context;
     this.temporalTableSqlGeneratorFactory = temporalTableSqlGeneratorFactory;
     this.tableHelper = tableHelper;
 }
コード例 #4
0
 public JwtRefreshTokenService(
     TableHelperRegistry tableHelperRegistry,
     IAccountService accountService,
     IJwtService jwtService)
 {
     _jwtService     = jwtService;
     _accountService = accountService;
     _tableHelper    = tableHelperRegistry.TableHelpers[Table.RefreshTokens];
 }
 public TemporalTablesMigrationsSqlGenerator(
     MigrationsSqlGeneratorDependencies dependencies,
     IRelationalAnnotationProvider migrationsAnnotations,
     ITemporalTableSqlGeneratorFactory temporalTableSqlGeneratorFactory,
     ITableHelper <TContext> tableHelper)
     : base(dependencies, migrationsAnnotations)
 {
     this.temporalTableSqlGeneratorFactory = temporalTableSqlGeneratorFactory;
     this.tableHelper = tableHelper;
 }
コード例 #6
0
ファイル: ScoreService.cs プロジェクト: r3core/ZendeskTicker
 public ScoreService(ITableHelper tableHelper, IConfiguration configuration)
 {
     _tableHelper   = tableHelper;
     _configuration = configuration;
 }
コード例 #7
0
 public MigrationService(ITableHelper tableHelper)
 {
     _tableHelper = tableHelper;
 }
コード例 #8
0
 public AccountService(TableHelperRegistry tableHelperRegistry)
 {
     _accountTableHelper = tableHelperRegistry.TableHelpers[Table.Accounts];
 }
コード例 #9
0
 public WorkTimesService(TableHelperRegistry tableHelperRegistry)
 {
     _tableHelper = tableHelperRegistry.TableHelpers[Table.WorkTimes];
 }