public CommonEntityStageManager(UserConnection userConnection, IGetRepository <CommonStageData> entityStageRepository, ICommonEntityInStageRepository <EntityInHistoricalStage> entityInStageRepository, StageHistorySetting stageHistorySetting) : base(userConnection, entityStageRepository, entityInStageRepository, stageHistorySetting) { }
private void CreateSettingFromEntity(Entity entity) { var setting = new StageHistorySetting(UserConnection); setting.FillFromEntity(entity); SetStageHistoryToCache(setting); }
private void SetStageHistoryToCache(StageHistorySetting setting) { var cache = GetSafelyStageHistoryFromCache(); cache[setting.EntitySchemaUId] = setting; UserConnection.ApplicationCache[CacheKey] = cache; }
/// <inheritdoc /> public void Save(StageHistorySetting setting) { setting.CheckArgumentNull(nameof(setting)); EntitySchema schema = UserConnection.EntitySchemaManager .GetInstanceByName(SysModuleStageHistorySchemaName); var entity = schema.CreateEntity(UserConnection); entity.FetchFromDB(setting.Id); setting.FillEntity(entity); entity.Save(false); SetStageHistoryToCache(setting); }
/// <summary> /// Returns proxy <see cref="CacheGetRepositoryProxy{TData}"/> of <see cref="FullPipelineStageGetRepository"/> /// </summary> /// <param name="stageHistorySetting"><see cref="StageHistorySetting"/></param> /// <returns>proxy <see cref="CacheGetRepositoryProxy{TData}"/> of <see cref="FullPipelineStageGetRepository"/></returns> public IGetRepository <CommonStageData> GetRepository(StageHistorySetting stageHistorySetting) { var repository = ClassFactory .Get <FullPipelineStageGetRepository>( new ConstructorArgument("userConnection", _userConnection), new ConstructorArgument("stageHistorySetting", stageHistorySetting)); var cacheRepository = ClassFactory .Get <CacheGetRepositoryProxy <CommonStageData> >( new ConstructorArgument("userConnection", _userConnection), new ConstructorArgument("repository", repository), new ConstructorArgument("schemaName", stageHistorySetting.StageSchemaName)); return(cacheRepository); }
private IEntityStageManagerV2 GetEntityStageManager(UserConnection userConnection, StageHistorySetting setting) { var entityStageRepository = ClassFactory.Get <IGetRepository <CommonStageData> >("StageGetRepository", new ConstructorArgument("userConnection", userConnection), new ConstructorArgument("stageHistorySetting", setting)); var cacheGetRepositoryProxy = ClassFactory.Get <CacheGetRepositoryProxy <CommonStageData> >( new ConstructorArgument("userConnection", userConnection), new ConstructorArgument("repository", entityStageRepository), new ConstructorArgument("schemaName", setting.StageSchemaName)); var entityInStageRepository = ClassFactory.Get <ICommonEntityInStageRepository <EntityInHistoricalStage> >( new ConstructorArgument("userConnection", userConnection), new ConstructorArgument("stageHistorySetting", setting)); return(ClassFactory.Get <IEntityStageManagerV2>(new ConstructorArgument("userConnection", userConnection), new ConstructorArgument("entityStageRepository", cacheGetRepositoryProxy), new ConstructorArgument("entityInStageRepository", entityInStageRepository), new ConstructorArgument("stageHistorySetting", setting))); }
private static bool IsChangedColumn(EntityAfterEventArgs entityAfterEventArgs, StageHistorySetting setting) { var column = entityAfterEventArgs?.ModifiedColumnValues?.FindByName(setting.StageColumnName + "Id"); return(column != null); }
private static bool IsStagedEntity(Entity entity, StageHistorySetting setting) { return(setting?.IsActive ?? false); }
private void ClearStageSchemaCache(StageHistorySetting currentSchemaSetting) { string schemaName = currentSchemaSetting.StageSchemaName; _userConnection.ApplicationCache.ExpireGroup(schemaName); }
public FullPipelineStageGetRepository(UserConnection userConnection, StageHistorySetting stageHistorySetting) : base(userConnection, stageHistorySetting) { }
public StageGetRepository(UserConnection userConnection, StageHistorySetting stageHistorySetting) : base(userConnection, stageHistorySetting.StageSchemaName) { StageHistorySetting = stageHistorySetting; }
public CommonEntityInStageRepository(UserConnection userConnection, StageHistorySetting stageHistorySetting) : base(userConnection, stageHistorySetting) { }
public CommonEntityStageRepository(UserConnection userConnection, StageHistorySetting entitySchemaConfig) : base(userConnection, entitySchemaConfig) { }