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
 public ScoreService(ITableHelper tableHelper, IConfiguration configuration)
 {
     _tableHelper   = tableHelper;
     _configuration = configuration;
 }
 public MigrationService(ITableHelper tableHelper)
 {
     _tableHelper = tableHelper;
 }
 public AccountService(TableHelperRegistry tableHelperRegistry)
 {
     _accountTableHelper = tableHelperRegistry.TableHelpers[Table.Accounts];
 }
예제 #9
0
 public WorkTimesService(TableHelperRegistry tableHelperRegistry)
 {
     _tableHelper = tableHelperRegistry.TableHelpers[Table.WorkTimes];
 }