private void AddTimeLineEntry(TLink entity, DateTime loadDate , IStoreLoadInformation loadInformation , IReferenceLoadInformation <TReference> loadReference , IEditedByInformation editedByInformation) { //timeline has no active entries TSatelliteTimeline defaultEntry = CreateDefaulTSatelliteTimeline(entity); SetLoadReference(defaultEntry as IReferenceLoadInformation <TReference>, loadReference); SetStoreLoadInformation(defaultEntry as IStoreLoadInformation, loadInformation); SetEditedBy(defaultEntry as IEditedByInformation, editedByInformation); if (UseKeyCaching == DVKeyCaching.Enabled) { //we insert link timeline entries only if there is no active one // the timeline cache only keeps active keys if (AddIfKeyIsUnique <TSatelliteTimeline>(entity.PrimaryKey)) { DbSetTimeline.Add(defaultEntry); } else { Logger?.LogTrace($"Primary key '{entity.PrimaryKey}' was already contained in '{nameof(IPrimaryKeyCache)}' for type '{typeof(TSatelliteTimeline)}'. Timeline is up to date."); } } else { TSatelliteTimeline current = GetCurrentOrDefaulTSatelliteTimeline(entity.PrimaryKey); if (current == default || current.EndDate != null) { DbSetTimeline.Add(defaultEntry); } } }
protected virtual void SetLoadReference(IReferenceLoadInformation <TReference> referenceLoad, IReferenceLoadInformation <TReference> loadReference) { if (referenceLoad != null && loadReference != null) { referenceLoad.LoadReference = loadReference.LoadReference; } }
protected override TLink AddEntity(TLink entity, DateTime loadDate , IStoreLoadInformation loadInformation , IReferenceLoadInformation <TReference> loadReference , IEditedByInformation editedByInformation) { entity = base.AddEntity(entity, loadDate, loadInformation, loadReference, editedByInformation); AddTimeLineEntry(entity, loadDate, loadInformation, loadReference, editedByInformation); return(entity); }
public virtual TEntity Insert(TEntity entity, DateTime loadDate , IStoreLoadInformation loadInformation , IReferenceLoadInformation <TReference> loadReference , IEditedByInformation editedByInformation) { AddEntity(entity, loadDate, loadInformation, loadReference, editedByInformation); Context.SaveChanges(); return(entity); }
public virtual List <TEntity> Insert(IEnumerable <TEntity> entities, DateTime loadDate , IStoreLoadInformation loadInformation , IReferenceLoadInformation <TReference> loadReference , IEditedByInformation editedByInformation) { foreach (var entity in entities) { AddEntity(entity, loadDate, loadInformation, loadReference, editedByInformation); } Context.SaveChanges(); return(entities.ToList()); }
protected virtual TEntity AddEntity(TEntity entity, DateTime loadDate , IStoreLoadInformation loadInformation , IReferenceLoadInformation <TReference> loadReference , IEditedByInformation editedByInformation) { entity.LoadDate = loadDate; SetLoadReference(entity as IReferenceLoadInformation <TReference>, loadReference); SetStoreLoadInformation(entity as IStoreLoadInformation, loadInformation); SetEditedBy(entity as IEditedByInformation, editedByInformation); CalculateHashes(entity); DBSetAddEntry(entity); return(entity); }
public List <TEntity> Insert(IEnumerable <TEntity> entities, DateTime loadDate, IReferenceLoadInformation <TReference> loadReference, IEditedByInformation editedByInformation) { return(Insert(entities, loadDate, null, loadReference, editedByInformation)); }
public TEntity Insert(TEntity entity, DateTime loadDate, IReferenceLoadInformation <TReference> loadReference, IEditedByInformation editedByInformation) { return(Insert(entity, loadDate, null, loadReference, editedByInformation)); }