/// <summary> /// Creates a new strategy for saving the specified type. /// </summary> /// <param name="typeName">The short name of the type involved in the strategy.</param> /// <param name="requiresAuthorisation">A value indicating whether the strategy requires authorisation.</param> static public ISaveStrategy New(string typeName, bool requiresAuthorisation) { ISaveStrategy strategy = StrategyState.Strategies.Creator.NewSaver(typeName); strategy.RequireAuthorisation = requiresAuthorisation; return(strategy); }
protected override void OnPreLoad(EventArgs e) { Response.CacheControl = "no-cache"; if (IdTipoDocumento < 0) { throw new ArgumentException(@"No se encontro el parametro", "Id Tipo Documento"); } var tipoDoc = DAOFactory.TipoDocumentoDAO.FindById(IdTipoDocumento); IdTipoDocumento = tipoDoc.Id; presenter = new PartePresentStrategy(tipoDoc, this, DAOFactory); saver = new ParteSaveStrategy(tipoDoc, this); presenter.CrearForm(); if (EditMode) { presenter.SetValores(EditObject); if (Usuario.AccessLevel < Logictracker.Types.BusinessObjects.Usuario.NivelAcceso.SysAdmin && EditObject.Valores[ParteCampos.EstadoControl].ToString() != "0") { PanelForm.Enabled = false; } } base.OnPreLoad(e); }
public StorageBox(Bucket bucket, ISaveStrategy saveStrategy, SaveRequestHandler saver) { this.Name = bucket.Name; this.UnderlyingBucket = bucket; this.SaveStrategy = saveStrategy; this.SaveHandler = saver; this.InnerBoxes = new Dictionary <string, StorageBox>(); }
public PoolObject(string route, string directory, string description, IInfoAccessor infoAccessor, ISaveStrategy saveStrategy) { Route = route; _directory = directory; Description = description; _infoAccessor = infoAccessor; _saveStrategy = saveStrategy; }
public RequestCreater(ISaveStrategy aRequestSaver, DataRepository SRepository, DataRepository LRepository, DataRepository JRepository) { _RequestSaver = aRequestSaver; _JRepository = JRepository; _LRepository = LRepository; _SRepository = SRepository; }
public PersistentList(IDataStore dataStore, ISerializer serializer, ISaveStrategy saveStrategy) { _dataStore = dataStore; _serializer = serializer; _items = new List <T>(); _serializer = serializer ?? new JsonSerializer(); _saveStrategy = saveStrategy ?? new SaveOnlyWhenRequested(); _saveStrategy.NotifyUnsolicitedSave += (sender, args) => Save(); Load(); }
private PersistentList <T> Create() { if (_serializer == null) { _serializer = new JsonSerializer(); } if (_saveStrategy == null) { _saveStrategy = new SaveOnlyWhenRequested(); } return(new PersistentList <T>(_dataStore, _serializer, _saveStrategy)); }
/// <summary> /// Creates a new strategy for saving the provided type. /// </summary> /// <param name="entity"></param> /// <param name="requireAuthorisation"></param> /// <returns>A save strategy for the provided type.</returns> static public ISaveStrategy New(IEntity entity, bool requireAuthorisation) { if (entity == null) { throw new ArgumentNullException("entity"); } ISaveStrategy strategy = StrategyState.Strategies.Creator.NewSaver(entity.ShortTypeName); strategy.RequireAuthorisation = requireAuthorisation; return(strategy); }
public PersistentList(IDataStore dataStore, ISaveStrategy saveStrategy) { _dataStore = dataStore; _items = new List <T>(); if (saveStrategy == null) { saveStrategy = new SaveOnlyWhenRequested(); } SaveStrategy = saveStrategy; SaveStrategy.NotifyUnsolicitedSave += (sender, args) => Save(); Load(); }
public StudentService(StrategySaveType typeValue, ICache <StudentModel> memoryCache) { SaveType param = SaveType.json; if (typeValue == StrategySaveType.xml) { param = SaveType.xml; } _saveStrategy = new SystemReposytory <Student.DAL.Model.Student>(param); _memoryCache = memoryCache; }
public App(IJsonService jsonService, IOptions <AppSettings> config, ILogger <App> logger, ISaveStrategy strategy, DbContextOptions options ) { _jsonService = jsonService; _logger = logger; _config = config.Value; _strategy = strategy; _options = options; }
public void Test_Save() { TestArticle article = CreateStrategy.New <TestArticle>(false).Create <TestArticle>(); article.ID = Guid.NewGuid(); StrategyInfo info = StrategyState.Strategies["Save", "IEntity"]; ISaveStrategy strategy = SaveStrategy.New <TestArticle>(false); strategy.Save(article); TestArticle foundArticle = Data.DataAccess.Data.Reader.GetEntity <TestArticle>("ID", article.ID); Assert.IsNotNull(foundArticle); }
public ElementWindow(IElementConfiguration appenderConfiguration, IElementDefinition propertyDefinition, IWindowSizeLocation windowSizeLocation, ISaveStrategy saveStrategy) : base(windowSizeLocation.RetentionKey) { InitializeComponent(); DataContext = this; mMessageBoxService = new MessageBoxService(this); mConfiguration = appenderConfiguration; mSaveStrategy = saveStrategy; SetWindowSizeLocation(windowSizeLocation); PropertyDefinition = propertyDefinition; PropertyDefinition.MessageBoxService = mMessageBoxService; Loaded += WindowOnLoaded; Icon = new BitmapImage(new Uri(PropertyDefinition.Icon)); }
public ElementWindow(IElementConfiguration appenderConfiguration, IElementDefinition propertyDefinition, IWindowSizeLocation windowSizeLocation, ISaveStrategy saveStrategy) : base(windowSizeLocation.RetentionKey) { InitializeComponent(); DataContext = this; mMessageBoxService = new MessageBoxService(this); mConfiguration = appenderConfiguration; WindowSizeLocation = windowSizeLocation; mSaveStrategy = saveStrategy; SetWindowSizeLocation(windowSizeLocation); PropertyDefinition = propertyDefinition; PropertyDefinition.MessageBoxService = mMessageBoxService; Properties = new ObservableCollection <IProperty>(); Loaded += WindowOnLoaded; ((INotifyCollectionChanged)PropertyDefinition.Properties).CollectionChanged += PropertiesOnCollectionChanged; Icon = new BitmapImage(new Uri(PropertyDefinition.Icon)); }
protected virtual StorageBox ResolveNamedSubContainer(string name, ISaveStrategy saveStrategy) { this.AssertBoxIsNotDeleted(); name = this.NomalizeName(name); if (this.InnerBoxes.ContainsKey(name)) { return(this.InnerBoxes[name]); } try { PermanentInfoStorage.ModificationsSyncRoot.EnterReadLock(); var appropriateBucket = this.GetOrCreateInnerBucket(name); var box = new StorageBox(appropriateBucket, saveStrategy, this.HandleSaveRequest); this.InnerBoxes[name] = box; return(box); } finally { PermanentInfoStorage.ModificationsSyncRoot.ExitReadLock(); this.HandleSaveRequest(); } }
public PersistentList <T> BackgroundSavingEveryMinute() { _saveStrategy = new BackgroundSave(TimeSpan.FromMinutes(1)); return(Create()); }
public BeverageRepository() : base("Beverage") { InsertStrategy = new BeverageInsertStrategy(this); UpdateStrategy = new BeverageUpdateStrategy(this); }
public ProductRepository() : base("Product") { InsertStrategy = new ProductInsertStrategy(this); UpdateStrategy = new ProductUpdateStrategy(this); }
public virtual IDataBox GetOrCreateSubBox(string name, ISaveStrategy saveStrategy) { return(this.ResolveNamedSubContainer(name, saveStrategy)); }
public SaveContext(ISaveStrategy strategy) { SaveStrategy = strategy; }
public OrderRepository() : base("Order") { InsertStrategy = new OrderInsertStrategy(this); UpdateStrategy = new OrderUpdateStrategy(this); }
public SaveContext(ISaveStrategy _strategy) { ContextStrategy = _strategy; }
public PersistentList <T> BackgroundSavingEvery(TimeSpan timeSpan) { _saveStrategy = new BackgroundSave(timeSpan); return(Create()); }
public DataContext(ISaveStrategy <T> saveStrategy) { this._strategySave = saveStrategy; }
public static PersistentList <T> Create <T>(ISaveStrategy saveStrategy) where T : new() { return(Create <T>("", saveStrategy)); }
public PersistentList <T> BackgroundSavingEveryFiveSeconds() { _saveStrategy = new BackgroundSave(TimeSpan.FromSeconds(5)); return(Create()); }
public static PersistentList <T> Create <T>(string path, ISaveStrategy saveStrategy) where T : new() { return(new PersistentList <T>(new FileSystem.FileSystem(path), saveStrategy)); }
public PersistentList <T> SavingWhenCollectionChanges() { _saveStrategy = new SaveOnEveryChange(); return(Create()); }
public void ChangeStarategy(ISaveStrategy <T> anyStrategy) { this._strategySave = anyStrategy; }
public PersistentList <T> SavingWhenRequested() { _saveStrategy = new SaveOnlyWhenRequested(); return(Create()); }