Beispiel #1
0
        public IDerivedEntity AttachSingleEntitiy(ResultSingleSerialData resultSingleSerialData)
        {
            var entityTypeName    = resultSingleSerialData.EntityTypeName;
            var derivedEntityList = this.TraverseResults(entityTypeName, new List <Dto>()
            {
                resultSingleSerialData.Item
            });

            this.AttachRelatedItems(resultSingleSerialData.RelatedItems);
            return(derivedEntityList.FirstOrDefault());
        }
Beispiel #2
0
        public ResultSingleSerialData GetSingleItem1(Dto partialDto, string[] expand)
        {
            var resultSingleSerialData = new ResultSingleSerialData()
            {
                Item           = null,
                EntityTypeName = this.entityTypeName,
                RelatedItems   = { }
            };

            if (this.dataContext.entitySets.ContainsKey(this.entityTypeName))
            {
                var entitySet     = (EntitySet <T>) this.dataContext.entitySets[this.entityTypeName];
                var derivedEntity = entitySet.FindByKey(partialDto /*partialEntity*/);
                resultSingleSerialData.Item = derivedEntity.entity.dto;
                DataViewLocalDtoUtils.FillResultSingleRelatedItems(this.entityTypeName, resultSingleSerialData, expand, this.dataContext, this.metadataSrv);
            }
            return(resultSingleSerialData);
        }
Beispiel #3
0
 public static void FillResultSingleRelatedItems(string entityTypeName, ResultSingleSerialData resultSingleSerialData, string[] expand, DataContext dataContext, MetadataSrv.Metadata metadataSrv)
 {
     if (resultSingleSerialData.Item != null)
     {
         var resultSerialData = new ResultSerialData()
         {
             Items = new List <Dto>()
             {
                 resultSingleSerialData.Item
             },
             EntityTypeName = entityTypeName,
             TotalCount     = 0,
             RelatedItems   = { }
         };
         FillResultRelatedItems(entityTypeName, resultSerialData, expand, dataContext, metadataSrv);
         resultSingleSerialData.RelatedItems = resultSerialData.RelatedItems;
     }
 }