Example #1
0
        protected override void DisposeManagedResources()
        {
            // clear repositories
            if (_repositories != null)
            {
                _repositories.Clear();
            }

            DataVaultContext.Dispose();
        }
Example #2
0
        public override TDvLinkEntity Find(string id, bool includeDetails = true)
        {
            var query = new
            {
                filterPK = DataVaultQuery <TDvLinkEntity> .FilterPK(id),
                select   = includeDetails ? new[] { "*" } : Array.Empty <object>()
            };

            return(DataVaultContext.ReadLinks <TDvLinkEntity>(query).FirstOrDefault());
        }
Example #3
0
 public TDvHubEntity[] GetListByIds(string[] ids, bool includeDetails = true)
 {
     return(ids.IsNullOrEmpty()
         ? Array.Empty <TDvHubEntity>()
         : DataVaultContext.ReadRecords <TDvHubEntity>(
                new
     {
         filter = new[] { DataVaultQuery <TDvHubEntity> .ContainPKs(ids) },
         select = includeDetails ? new[] { "*" } : Array.Empty <object>(),
     }));
 }
Example #4
0
 public TDvHubEntity[] GetList <TSat>(TSat satQuery, bool includeDetails = true) where TSat : ISat, new()
 {
     return(DataVaultContext.ReadRecords <TDvHubEntity>(DataVaultQuery <TDvHubEntity> .FilterSat(satQuery)));
 }
Example #5
0
 public TDvHubEntity FindByHub <THub>(THub hubData, bool includeDetails = true) where THub : IHub, new()
 {
     return(DataVaultContext.ReadRecord <TDvHubEntity>(hubData, includeDetails ? new[] { "*" } : Array.Empty <object>()));
 }
Example #6
0
 public TDvHubEntity FindByBk(string bk, bool includeDetails = true)
 {
     return(DataVaultContext.ReadRecord <TDvHubEntity>(DataVaultQuery <TDvHubEntity> .EqualsBK(bk), includeDetails ? new[] { "*" } : Array.Empty <object>()));
 }
Example #7
0
        public override void Update(string id, TDvHubEntity entity)
        {
            ReflectionHelper.SetValueByPath(entity, typeof(TDvHubEntity), $"{EntityHelper.GetHubPropertyName(entity.GetType())}", null);

            DataVaultContext.UpdateRecord <TDvHubEntity>(id, entity);
        }
Example #8
0
        public override void Delete(string id)
        {
            Get(id, false);

            DataVaultContext.DeleteRecord <TDvHubEntity>(id);
        }
Example #9
0
 public override TDvHubEntity Find(string id, bool includeDetails = true)
 {
     return(DataVaultContext.ReadRecord <TDvHubEntity>(DataVaultQuery <TDvHubEntity> .EqualsPK(id), includeDetails ? new[] { "*" } : Array.Empty <object>()));
 }
Example #10
0
 public override string Create(TDvHubEntity entity)
 {
     return(DataVaultContext.CreateRecord <TDvHubEntity>(entity.GetHubData(), entity));
 }
Example #11
0
 public void Complete()
 {
     DataVaultContext.SaveChanges();
     IsCompleted = true;
 }
Example #12
0
 public override string Create(TDvLinkEntity entity)
 {
     return(DataVaultContext.LinkRecord <TDvLinkEntity>(entity.GetLinkData(), entity));
 }
Example #13
0
 public DatavaultAccessLayer(DataVaultContext dbContext)
 {
     _dbContext = dbContext;
 }
Example #14
0
 public TDvLinkEntity[] GetList <TLink, TSat>(TLink link, TSat sat, bool includeDetails = true)
     where TLink : ILink, new()
     where TSat : ISat, new()
 {
     return(DataVaultContext.ReadLinks <TDvLinkEntity>(DataVaultQuery <TDvLinkEntity> .FilterLink(link, sat)));
 }
Example #15
0
        //public TDvLinkEntity[] GetList<TRelatedHub>(string[] relatedHubIds, bool includeDetails = true)
        //{
        //    return DataVaultContext.ReadLinks<TDvLinkEntity>(DataVaultQuery<TDvLinkEntity>.RelatedHub<TRelatedHub>(relatedHubIds));
        //}

        public TDvLinkEntity[] GetListByLink <TLink>(TLink link, bool includeDetails = true) where TLink : ILink, new()
        {
            return(DataVaultContext.ReadLinks <TDvLinkEntity>(DataVaultQuery <TDvLinkEntity> .FilterPK(link)));
        }
Example #16
0
 public override void Delete(string id)
 {
     DataVaultContext.UnLinkRecord <TDvLinkEntity>(id);
 }
Example #17
0
 public override void Update(string id, TDvLinkEntity entity)
 {
     DataVaultContext.UpdateLink <TDvLinkEntity>(id, entity);
 }