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);
                }
            }
        }
Ejemplo n.º 2
0
 protected virtual void SetEditedBy(IEditedByInformation edited, IEditedByInformation editedByInformation)
 {
     if (edited != null)
     {
         edited.EditedBy = editedByInformation.EditedBy;
     }
 }
 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);
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 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());
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 public List <TEntity> Insert(IEnumerable <TEntity> entities, DateTime loadDate, IStoreLoadInformation loadInformation, IEditedByInformation editedByInformation)
 {
     return(Insert(entities, loadDate, loadInformation, null, editedByInformation));
 }
Ejemplo n.º 8
0
 public List <TEntity> Insert(IEnumerable <TEntity> entities, DateTime loadDate, IReferenceLoadInformation <TReference> loadReference, IEditedByInformation editedByInformation)
 {
     return(Insert(entities, loadDate, null, loadReference, editedByInformation));
 }
Ejemplo n.º 9
0
 public TEntity Insert(TEntity entity, DateTime loadDate, IReferenceLoadInformation <TReference> loadReference, IEditedByInformation editedByInformation)
 {
     return(Insert(entity, loadDate, null, loadReference, editedByInformation));
 }
Ejemplo n.º 10
0
 public TEntity Insert(TEntity entity, DateTime loadDate, IStoreLoadInformation loadInformation, IEditedByInformation editedByInformation)
 {
     return(Insert(entity, loadDate, loadInformation, null, editedByInformation));
 }