public IEntityDefinition GetEntityDefinition(IEntityKey key)
        {
            IEntityDefinition entityDefinition;

            TryGetEntityDefinition(key, out entityDefinition);
            return(entityDefinition);
        }
Пример #2
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     var comp = key as AssetKey;
     if (comp != null && Components != null)
         Components.Remove(comp);
 }
Пример #3
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     var entity = key as EntityKey;
     if(ChildAssetsOrTypes == null || entity == null) return;
     ChildAssetsOrTypes.Remove(entity);
 }
Пример #4
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     var space = key as SpaceKey;
     if(space == null || Spaces == null) return;
     Spaces.Remove(space);
 }
Пример #5
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     var space = key as SpaceKey;
     if (space != null && Spaces != null)
         Spaces.Remove(space);
 }
Пример #6
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     var contact = key as ContactKey;
     if (contact != null && Suppliers != null)
         Suppliers.Remove(contact);
 }
Пример #7
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     if (ApprovalBy == key)
     {
         ApprovalBy = null;
     }
 }
Пример #8
0
        public static TEntity SaveEntity <TEntity>(IEntityKey t, ref IMDResponse res) where TEntity : class, IBaseEntity
        {
            UnitWork uw = new UnitWork();
            var      x  = uw.Command <TEntity>().MapAndSave(t, ref res);

            uw.Save(ref res);
            return(x);
        }
Пример #9
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     if (ConnectedTo == key)
         ConnectedTo = null;
     if (RealizingElement == key)
         RealizingElement = null;
 }
Пример #10
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     if (Owner == key)
         Owner = null;
     if (IssueWith == key)
         IssueWith = null;
 }
Пример #11
0
        internal override void RemoveKey(IEntityKey key)
        {
            base.RemoveKey(key);
            var comp = key as AssetKey;

            if (comp != null && Components != null)
            {
                Components.Remove(comp);
            }
        }
Пример #12
0
        internal override void RemoveKey(IEntityKey key)
        {
            base.RemoveKey(key);
            var contact = key as ContactKey;

            if (contact != null && Suppliers != null)
            {
                Suppliers.Remove(contact);
            }
        }
Пример #13
0
 bool IEntityDefinitionProvider.TryGetEntityDefinition(IEntityKey entityKey,
                                                       out IEntityDefinition entityDefinition)
 {
     if (entityKey is ENTITY_KEY)
     {
         return(TryGetEntityDefinition((ENTITY_KEY)entityKey, out entityDefinition));
     }
     entityDefinition = null;
     return(false);
 }
Пример #14
0
        internal override void RemoveKey(IEntityKey key)
        {
            base.RemoveKey(key);
            var space = key as SpaceKey;

            if (space != null && Spaces != null)
            {
                Spaces.Remove(space);
            }
        }
Пример #15
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     var job = key as JobKey;
     if (job != null && Priors != null)
         Priors.Remove(job);
     var res = key as ResourceKey;
     if (res != null && Resources != null)
         Resources.Remove(res);
 }
Пример #16
0
        internal override void RemoveKey(IEntityKey key)
        {
            base.RemoveKey(key);
            var space = key as SpaceKey;

            if (space == null || Spaces == null)
            {
                return;
            }
            Spaces.Remove(space);
        }
Пример #17
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     if (Manufacturer == key)
         Manufacturer = null;
     if(Warranty == null) return;
     if (Warranty.GuarantorLabor == key)
         Warranty.GuarantorLabor = null;
     if (Warranty.GuarantorParts == key)
         Warranty.GuarantorParts = null;
 }
Пример #18
0
        internal override void RemoveKey(IEntityKey key)
        {
            base.RemoveKey(key);
            var entity = key as EntityKey;

            if (ChildAssetsOrTypes == null || entity == null)
            {
                return;
            }
            ChildAssetsOrTypes.Remove(entity);
        }
Пример #19
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     if (ConnectedTo == key)
     {
         ConnectedTo = null;
     }
     if (RealizingElement == key)
     {
         RealizingElement = null;
     }
 }
Пример #20
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     if (Owner == key)
     {
         Owner = null;
     }
     if (IssueWith == key)
     {
         IssueWith = null;
     }
 }
Пример #21
0
        internal override void RemoveKey(IEntityKey key)
        {
            base.RemoveKey(key);
            var job = key as JobKey;

            if (job != null && Priors != null)
            {
                Priors.Remove(job);
            }
            var res = key as ResourceKey;

            if (res != null && Resources != null)
            {
                Resources.Remove(res);
            }
        }
Пример #22
0
        public static List <T> ManyToMany <TEntity, T>(UnitWork uw, IEntityKey vm, Expression <Func <TEntity, object> > include, List <long> ids, ref IMDResponse res)
            where TEntity : class, IBaseEntity
            where T : class, IBaseEntity
        {
            var x = new List <T>();
            Func <TEntity, object> func = include.Compile();
            var ent = uw.QueryEntity <TEntity>().GetByID(vm.Id, false, include);

            if (ent != null && func(ent) != null)
            {
                (func(ent) as ICollection <T>).Clear(); uw.Command <TEntity>().Update(ent, ref res);
            }
            if (ids != null)
            {
                x.AddRange(uw.QueryEntity <T>().GetByIDs(ids.ToArray()));
            }
            return(x);
        }
Пример #23
0
        public async Task <T> GetAsync(IEntityKey key)
        {
            try
            {
                var response = await Container.ReadItemAsync <T>(key.Id, new PartitionKey(key.PartitionKey));

                var rus        = response.RequestCharge;
                var statusCode = response.StatusCode;
                TrackRequestCharge($"GetAsync: {statusCode}", rus, key.PartitionKey);
                return(response.Resource);
            }
            catch (CosmosException cex)
            {
                if (cex.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    return(null);
                }
                throw;
            }
        }
Пример #24
0
 internal override void RemoveKey(IEntityKey key)
 {
     base.RemoveKey(key);
     if (Manufacturer == key)
     {
         Manufacturer = null;
     }
     if (Warranty == null)
     {
         return;
     }
     if (Warranty.GuarantorLabor == key)
     {
         Warranty.GuarantorLabor = null;
     }
     if (Warranty.GuarantorParts == key)
     {
         Warranty.GuarantorParts = null;
     }
 }
Пример #25
0
 private async ValueTask <T> GetWithDetails(IEntityKey <T> key, ReadConsistency consistency)
 {
     return(await WithDetailsSingle(consistency).FirstOrDefaultAsync(key.GetFilter()));
 }
Пример #26
0
 /// <summary>
 /// Gets an entity by the primary key.
 /// </summary>
 /// <param name="key">The key for the entity.</param>
 /// <returns>
 /// An instance of the entity or null if not found.
 /// </returns>
 /// <remarks>
 /// This method provides a common retrieval of an entity.
 /// </remarks>
 /// <exception cref="NotImplementedException"></exception>
 public virtual TEntity GetByKey(IEntityKey key)
 {
     throw new NotImplementedException();
 }
Пример #27
0
 public bool TryGetEntry <TEntity>(IEntityKey key, out MapperContextEntry entry)
 {
     return(_entries.TryGetValue(new MapperContextKey(typeof(TEntity), key), out entry));
 }
Пример #28
0
 public static EntityFetchExpression AllFieldsExpression(IEntityKey entityKey)
 {
     return(new AllFieldsFetchExpression(entityKey));
 }
Пример #29
0
 protected EntityFetchExpression(IEntityKey entityKey)
 {
     _entityKey = entityKey;
 }
Пример #30
0
        public async ValueTask Remove(IEntityKey <T> key)
        {
            var item = await _context.FindAsync <T>(key.GetValues());

            Remove(item);
        }
 public bool TryGetEntityDefinition(IEntityKey key, out IEntityDefinition value)
 {
     return(_entityDefinitions.TryGetValue(key, out value));
 }
Пример #32
0
 public StringEntityFetchExpression(ICollection <string> fields, IEntityKey entityKey) : base(entityKey)
 {
     _fields = fields;
 }
 public void Add(IEntityKey entityKey, IEntityDefinition entityDefinition)
 {
     _entityDefinitions.Add(entityKey, entityDefinition);
 }
Пример #34
0
        public bool Equals(IEntityKey key)
        {
            NamedKey namedKey = key as NamedKey;

            return(namedKey != null && string.Equals(_name, namedKey.Name, StringComparison.CurrentCultureIgnoreCase));
        }
Пример #35
0
 public abstract bool Equals(IEntityKey key);
Пример #36
0
        public bool Equals(IEntityKey key)
        {
            var reflectedEntityKey = key as ReflectedEntityKey;

            return(reflectedEntityKey != null && reflectedEntityKey._entityType == _entityType);
        }
Пример #37
0
 IEntityDefinition IEntityDefinitionProvider.GetEntityDefinition(IEntityKey entityKey)
 {
     return(GetEntityDefinition((ENTITY_KEY)entityKey));
 }
Пример #38
0
 public AllFieldsFetchExpression(IEntityKey entityKey) : base(entityKey)
 {
 }