コード例 #1
0
        IEdmEntityObject Map(IEdmModel model, ClassA a)
        {
            var type = (IEdmEntityType)GetType(model, a.GetType());

            var e = new EdmEntityObject(type);

            e.TrySetPropertyValue("Name", a.Name);

            e.TrySetPropertyValue("Poly", Map(model, a.Poly));

            _polysProp = _polysProp ?? type.FindProperty("Polys");
            e.TrySetPropertyValue("Polys", new EdmComplexObjectCollection((IEdmCollectionTypeReference)_polysProp.Type,
                                                                          a.Polys.Select(p => Map(model, p)).ToArray()));

            var b = a as ClassB;

            if (b != null)
            {
                e.TrySetPropertyValue("Test", b.Test);
            }
            var c = a as ClassC;

            if (c != null)
            {
                e.TrySetPropertyValue("Test2", c.Test2);
            }

            return(e);
        }
コード例 #2
0
        public void SendAsync_WritesETagToResponseHeaders_InUntyped()
        {
            // Arrange
            IEdmModel          model   = GetUnTypeEdmModel();
            HttpRequestMessage request = SetupRequest(HttpMethod.Get, "Customers(3)", model);

            IEdmEntityType  entityType = model.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "Customer");
            EdmEntityObject customer   = new EdmEntityObject(entityType);

            customer.TrySetPropertyValue("ID", 3);
            customer.TrySetPropertyValue("Name", "Sam");

            HttpResponseMessage originalResponse = SetupResponse(HttpStatusCode.OK, typeof(EdmEntityObject), customer);
            ETagMessageHandler  handler          = new ETagMessageHandler()
            {
                InnerHandler = new TestHandler(originalResponse)
            };

            // Act
            HttpResponseMessage response = handler.SendAsync(request).Result;

            // Assert
            Assert.NotNull(response.Headers.ETag);
            Assert.Equal("\"J1NhbSc=\"", response.Headers.ETag.Tag);
        }
コード例 #3
0
        private static IEdmEntityObject CreatePerson(IEdmEntityType edmType, int id)
        {
            var edmEntity = new EdmEntityObject(edmType);

            edmEntity.TrySetPropertyValue("Id", id);
            edmEntity.TrySetPropertyValue("FirstName", "Jörg " + id);
            edmEntity.TrySetPropertyValue("LastName", "Metzler " + id);
            return(edmEntity);
        }
コード例 #4
0
ファイル: ETagsUntypedTests.cs プロジェクト: tvdburgt/WebApi
        public IHttpActionResult Get(int key)
        {
            IEdmModel       model      = Request.ODataProperties().Model;
            IEdmEntityType  entityType = model.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "Customer");
            EdmEntityObject customer   = new EdmEntityObject(entityType);

            customer.TrySetPropertyValue("ID", key);
            customer.TrySetPropertyValue("Name", "Sam");
            return(Ok(customer));
        }
コード例 #5
0
        public void Get(ODataQueryOptions queryOptions, IEdmEntityTypeReference entityType, EdmEntityObjectCollection collection)
        {
            var name = entityType.Definition.FullTypeName().Remove(0, EdmNamespaceName.Length + 1); // ns.
            var obj  = new EdmEntityObject(entityType);

            obj.TrySetPropertyValue("Column1", "Hello World");
            obj.TrySetPropertyValue("Column2", "Hello World");

            collection.Add(obj);
        }
コード例 #6
0
        public void Get(IEdmEntityTypeReference entityType, EdmEntityObjectCollection collection)
        {
            EdmEntityObject entity = new EdmEntityObject(entityType);

            entity.TrySetPropertyValue("Name", "Foo");
            entity.TrySetPropertyValue("ID", 100);
            collection.Add(entity);
            entity = new EdmEntityObject(entityType);
            entity.TrySetPropertyValue("Name", "Bar");
            entity.TrySetPropertyValue("ID", 101);
            collection.Add(entity);
        }
コード例 #7
0
        private IEnumerable <IEdmEntityObject> GetData(IEdmEntityType entityType)
        {
            for (int id = 1; id <= 1_000_000; id++)
            {
                EdmEntityObject entity = new EdmEntityObject(entityType);

                entity.TrySetPropertyValue("CustomerId", id);
                entity.TrySetPropertyValue("Data", new byte[1000]);

                yield return(entity);

                Trace.WriteLine($"Yielded {id:N0} rows.");
            }
        }
コード例 #8
0
        private IEdmEntityObject Createchool(int id, DateTimeOffset dto, IEdmStructuredType edmType)
        {
            IEdmNavigationProperty navigationProperty = edmType.DeclaredProperties.OfType <EdmNavigationProperty>().FirstOrDefault(e => e.Name == "School");

            if (navigationProperty == null)
            {
                return(null);
            }

            EdmEntityObject entity = new EdmEntityObject(navigationProperty.ToEntityType());

            entity.TrySetPropertyValue("ID", id);
            entity.TrySetPropertyValue("CreatedDay", dto);
            return(entity);
        }
コード例 #9
0
        private IEdmEntityObject CreateDetailInfo(int id, string title, IEdmStructuredType edmType)
        {
            IEdmNavigationProperty navigationProperty = edmType.DeclaredProperties.OfType <EdmNavigationProperty>().FirstOrDefault(e => e.Name == "DetailInfo");

            if (navigationProperty == null)
            {
                return(null);
            }

            EdmEntityObject entity = new EdmEntityObject(navigationProperty.ToEntityType());

            entity.TrySetPropertyValue("ID", id);
            entity.TrySetPropertyValue("Title", title);
            return(entity);
        }
コード例 #10
0
    public static IList <IEdmEntityObject> ReadData(IEdmEntityType type, DatabaseTable table, string connectionString)
    {
        List <IEdmEntityObject> list = new List <IEdmEntityObject>();
        // https://www.nuget.org/packages/DatabaseSchemaReader/
        Reader reader = new Reader(table, connectionString, "System.Data.SqlClient");

        reader.Read((r) =>
        {
            EdmEntityObject obj = new EdmEntityObject(type);
            foreach (var prop in type.DeclaredProperties)
            {
                int index    = r.GetOrdinal(prop.Name);
                object value = r.GetValue(index);
                if (Convert.IsDBNull(value))
                {
                    value = null;
                }
                obj.TrySetPropertyValue(prop.Name, value);
            }
            list.Add(obj);
            // uncomment these 2 lines if you're just testing maximum 10 rows on a table
            //if (list.Count == 10)
            //    return false;
            return(true);
        });
        return(list);
    }
コード例 #11
0
        public void Get(IEdmEntityTypeReference entityType, EdmEntityObjectCollection collection)
        {
            EdmEntityObject entity = new EdmEntityObject(entityType);

            entity.TrySetPropertyValue("Name", "abc");
            entity.TrySetPropertyValue("ID", 1);
            entity.TrySetPropertyValue("DetailInfo", CreateDetailInfo(88, "abc_detailinfo", entity.ActualEdmType));

            collection.Add(entity);
            entity = new EdmEntityObject(entityType);
            entity.TrySetPropertyValue("Name", "def");
            entity.TrySetPropertyValue("ID", 2);
            entity.TrySetPropertyValue("DetailInfo", CreateDetailInfo(99, "def_detailinfo", entity.ActualEdmType));

            collection.Add(entity);
        }
コード例 #12
0
        public void Get(IEdmEntityTypeReference entityType, EdmEntityObjectCollection collection)
        {
            EdmEntityObject entity = new EdmEntityObject(entityType);

            entity.TrySetPropertyValue("Name", "Foo");
            entity.TrySetPropertyValue("ID", 100);
            entity.TrySetPropertyValue("School", Createchool(99, new DateTimeOffset(2016, 1, 19, 1, 2, 3, TimeSpan.Zero), entity.ActualEdmType));
            collection.Add(entity);

            entity = new EdmEntityObject(entityType);
            entity.TrySetPropertyValue("Name", "Bar");
            entity.TrySetPropertyValue("ID", 101);
            entity.TrySetPropertyValue("School", Createchool(99, new DateTimeOffset(1978, 11, 15, 1, 2, 3, TimeSpan.Zero), entity.ActualEdmType));

            collection.Add(entity);
        }
コード例 #13
0
        public void Index([FromBody] ODataUntypedActionParameters parameters)
        {
            IEdmModel model = Request.ODataProperties().Model;
            IEdmEntityTypeReference docTypeRef = model.GetDocTypeRef();
            IEdmEntityType          docType    = docTypeRef.EntityDefinition();

            IEdmEntityObject CopyDocument(IEdmComplexObject source)
            {
                var target = new EdmEntityObject(docTypeRef);

                foreach (string propertyName in docType.StructuralProperties().Select(p => p.Name))
                {
                    if (source.TryGetPropertyValue(propertyName, out object propertyValue))
                    {
                        target.TrySetPropertyValue(propertyName, propertyValue);
                    }
                }

                return(target);
            }

            var documentsObjects = (EdmComplexObjectCollection)parameters["value"];
            IEnumerable <IEdmEntityObject> documents = documentsObjects.Select(CopyDocument);

            Documents.AddRange(documents);
        }
コード例 #14
0
        protected IEnumerable <IEdmEntityObject> GetFilteredResult(IEnumerable <Dictionary <string, object> > group, string query, ParseContext parseContext)
        {
            // Create collection from group
            var collectionEntityTypeKey = parseContext.LatestStateDictionary
                                          .Keys.FirstOrDefault(p => p.Contains("collectionentitytype"));
            var entityRef     = (EdmEntityTypeReference)parseContext.LatestStateDictionary[collectionEntityTypeKey];
            var collectionRef = new EdmCollectionTypeReference(new EdmCollectionType(entityRef));
            var collection    = new EdmEntityObjectCollection(collectionRef);

            foreach (var entity in group)
            {
                var obj = new EdmEntityObject(entityRef);
                foreach (var kvp in entity)
                {
                    obj.TrySetPropertyValue(kvp.Key, kvp.Value);
                }
                collection.Add(obj);
            }
            // Create filter query using the entity supplied in the lateststatedictionary
            var serviceRoot    = new Uri(RequestFilterConstants.ODataServiceRoot);
            var resource       = entityRef.Definition.FullTypeName().Split(".").Last();
            var filterQuery    = "/" + resource + "?$filter=" + Uri.EscapeDataString(query.Substring(1, query.Length - 2).Replace("''", "'"));
            var oDataUriParser = new ODataUriParser(parseContext.Model, new Uri(filterQuery, UriKind.Relative));

            // Parse filterquery
            var filter         = oDataUriParser.ParseFilter();
            var odataFilter    = new ODataFilterPredicateParser();
            var filteredResult = odataFilter.ApplyFilter(parseContext.EdmEntityTypeSettings.FirstOrDefault(), collection, filter.Expression);

            return(filteredResult);
        }
コード例 #15
0
        public IHttpActionResult Get()
        {
            IEdmModel      model        = Request.GetModel();
            IEdmEntityType customerType = model.SchemaElements.OfType <IEdmEntityType>().First(e => e.Name == "Customer");

            EdmEntityObject customer = new EdmEntityObject(customerType);

            customer.TrySetPropertyValue("Id", 1);
            customer.TrySetPropertyValue("Tony", 1);

            EdmEntityObjectCollection customers =
                new EdmEntityObjectCollection(
                    new EdmCollectionTypeReference(new EdmCollectionType(customerType.ToEdmTypeReference(false))));

            customers.Add(customer);
            return(Ok(customers));
        }
コード例 #16
0
        private EdmEntityObjectCollection GetCustomers()
        {
            IEdmModel edmModel = Request.ODataProperties().Model;

            IEdmEntityType  customerType = edmModel.SchemaElements.OfType <IEdmEntityType>().Single(e => e.Name == "Customer");
            IEdmEnumType    colorType    = edmModel.SchemaElements.OfType <IEdmEnumType>().Single(e => e.Name == "Color");
            IEdmComplexType addressType  = edmModel.SchemaElements.OfType <IEdmComplexType>().Single(e => e.Name == "Address");

            // an enum object
            EdmEnumObject color = new EdmEnumObject(colorType, "Red");

            // a complex object
            EdmComplexObject address1 = new EdmComplexObject(addressType);

            address1.TrySetPropertyValue("Street", "ZiXing Rd");                                            // Declared property
            address1.TrySetPropertyValue("StringProperty", "CN");                                           // a string dynamic property
            address1.TrySetPropertyValue("GuidProperty", new Guid("181D3A20-B41A-489F-9F15-F91F0F6C9ECA")); // a guid dynamic property

            // another complex object with complex dynamic property
            EdmComplexObject address2 = new EdmComplexObject(addressType);

            address2.TrySetPropertyValue("Street", "ZiXing Rd");       // Declared property
            address2.TrySetPropertyValue("AddressProperty", address1); // a complex dynamic property

            // an entity object
            EdmEntityObject customer = new EdmEntityObject(customerType);

            customer.TrySetPropertyValue("CustomerId", 1);      // Declared property
            customer.TrySetPropertyValue("Name", "Mike");       // Declared property
            customer.TrySetPropertyValue("Color", color);       // an enum dynamic property
            customer.TrySetPropertyValue("Address1", address1); // a complex dynamic property
            customer.TrySetPropertyValue("Address2", address2); // another complex dynamic property

            // a collection with one object
            EdmEntityObjectCollection collection =
                new EdmEntityObjectCollection(
                    new EdmCollectionTypeReference(
                        new EdmCollectionType(new EdmEntityTypeReference(customerType, isNullable: true))));

            collection.Add(customer);

            return(collection);
        }
コード例 #17
0
        private EdmEntityObject GetEdmEntityObject(Dictionary <string, object> keyValuePairs, IEdmEntityTypeReference edmEntityType)
        {
            var obj = new EdmEntityObject(edmEntityType);

            foreach (var kvp in keyValuePairs)
            {
                obj.TrySetPropertyValue(kvp.Key, kvp.Value);
            }
            return(obj);
        }
        public static void PrepareHttpResponseMessage(ref HttpResponseMessage msg, string mediaType, DataObjectEdmModel model, byte[] buffer)
        {
            List <IEdmEntityObject> edmObjList = new List <IEdmEntityObject>();
            var edmObj = new EdmEntityObject(model.GetEdmEntityType(typeof(DataObject)));

            edmObj.TrySetPropertyValue("__PrimaryKey", buffer);
            edmObjList.Add(edmObj);
            IEdmCollectionTypeReference entityCollectionType = new EdmCollectionTypeReference(new EdmCollectionType(edmObj.GetEdmType()));
            EdmEntityObjectCollection   collection           = new EdmEntityObjectCollection(entityCollectionType, edmObjList);

            msg.Content = new ObjectContent(typeof(EdmEntityObjectCollection), collection, new RawOutputFormatter(), mediaType);
        }
コード例 #19
0
        private static EdmEntityObjectCollection GetCustomers()
        {
            if (_untypedSimpleOpenCustormers != null)
            {
                return(_untypedSimpleOpenCustormers);
            }

            IEdmModel       edmModel     = OpenEntityTypeTests.GetUntypedEdmModel();
            IEdmEntityType  customerType = edmModel.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "UntypedSimpleOpenCustomer");
            EdmEntityObject customer     = new EdmEntityObject(customerType);

            customer.TrySetPropertyValue("CustomerId", 1);

            //Add Numbers primitive collection property
            customer.TrySetPropertyValue("DeclaredNumbers", new[] { 1, 2 });

            //Add Color, Colors enum(collection) property
            IEdmEnumType  colorType = edmModel.SchemaElements.OfType <IEdmEnumType>().First(c => c.Name == "Color");
            EdmEnumObject color     = new EdmEnumObject(colorType, "Red");
            EdmEnumObject color2    = new EdmEnumObject(colorType, "0");
            EdmEnumObject color3    = new EdmEnumObject(colorType, "Red");

            customer.TrySetPropertyValue("Color", color);

            List <IEdmEnumObject> colorList = new List <IEdmEnumObject>();

            colorList.Add(color);
            colorList.Add(color2);
            colorList.Add(color3);
            IEdmCollectionTypeReference enumCollectionType = new EdmCollectionTypeReference(new EdmCollectionType(colorType.ToEdmTypeReference(false)));
            EdmEnumObjectCollection     colors             = new EdmEnumObjectCollection(enumCollectionType, colorList);

            customer.TrySetPropertyValue("Colors", colors);
            customer.TrySetPropertyValue("DeclaredColors", colors);

            //Add Addresses complex(collection) property
            EdmComplexType addressType =
                edmModel.SchemaElements.OfType <IEdmComplexType>().First(c => c.Name == "Address") as EdmComplexType;
            EdmComplexObject address = new EdmComplexObject(addressType);

            address.TrySetPropertyValue("Street", "No1");
            EdmComplexObject address2 = new EdmComplexObject(addressType);

            address2.TrySetPropertyValue("Street", "No2");

            List <IEdmComplexObject> addressList = new List <IEdmComplexObject>();

            addressList.Add(address);
            addressList.Add(address2);
            IEdmCollectionTypeReference complexCollectionType = new EdmCollectionTypeReference(new EdmCollectionType(addressType.ToEdmTypeReference(false)));
            EdmComplexObjectCollection  addresses             = new EdmComplexObjectCollection(complexCollectionType, addressList);

            customer.TrySetPropertyValue("DeclaredAddresses", addresses);

            EdmEntityObjectCollection customers = new EdmEntityObjectCollection(new EdmCollectionTypeReference(new EdmCollectionType(customerType.ToEdmTypeReference(false))));

            customers.Add(customer);
            _untypedSimpleOpenCustormers = customers;
            return(_untypedSimpleOpenCustormers);
        }
コード例 #20
0
 private void AddAggregationPropertyValuesToModel(Dictionary <string, object> targetQueryableDictionary
                                                  , EdmEntityObject obj
                                                  , IEnumerable <Dictionary <string, object> > group
                                                  , EdmComplexType edmComplexType
                                                  , Dictionary <string, AggregateExpression> aggregatePropList)
 {
     foreach (var property in aggregatePropList)
     {
         var val           = aggregatePropList[property.Key];
         var primitiveKind = val.Expression.TypeReference.PrimitiveKind();
         if (val.Method != AggregationMethod.Custom)
         {
             var sourcePropertyName = val.Method != AggregationMethod.VirtualPropertyCount ?
                                      ((SingleValuePropertyAccessNode)val.Expression).Property.Name : null;
             var value = GetAggregatedValue(sourcePropertyName, val, group, primitiveKind);
             obj.TrySetPropertyValue(val.Alias, value);
             targetQueryableDictionary.Add(val.Alias, value);
         }
         else
         {
             object value;
             if (val.MethodDefinition.MethodLabel.Contains(ODataFilterConstants.AggregationMethod_Custom_List, StringComparison.OrdinalIgnoreCase))
             {
                 value = GetAggregatedValue(property.Key, val, group, EdmPrimitiveTypeKind.None, edmComplexType);
                 var subcollectionContext = (SubCollectionContext)value;
                 obj.TrySetPropertyValue(property.Key, subcollectionContext.Result);
                 targetQueryableDictionary.Add(property.Key, subcollectionContext.QueryAbleResult);
             }
             else if (val.MethodDefinition.MethodLabel.Contains(ODataFilterConstants.AggregationMethod_Custom_CountDistinct, StringComparison.OrdinalIgnoreCase) ||
                      val.MethodDefinition.MethodLabel.Contains(ODataFilterConstants.AggregationMethod_Custom_Count, StringComparison.OrdinalIgnoreCase))
             {
                 var sourcePropertyName = ((SingleValuePropertyAccessNode)val.Expression).Property.Name;
                 value = GetAggregatedValue(sourcePropertyName, val, group, EdmPrimitiveTypeKind.None);
                 obj.TrySetPropertyValue(val.Alias, value);
                 targetQueryableDictionary.Add(val.Alias, value);
             }
         }
     }
 }
コード例 #21
0
        public IHttpActionResult GetStatementFromPaymentInstument(int key, int navKey)
        {
            var payinPIs  = _dataSource.Accounts.Single(a => a.AccountID == key).PayinPIs;
            var payinPI   = payinPIs.Single(pi => pi.PaymentInstrumentID == navKey);
            var statement = payinPI.Statement;

            IEdmEntityType  productType     = GetEdmEntityTypeOfStatement();
            EdmEntityObject statementObject = new EdmEntityObject(productType);
            var             properties      = typeof(Statement).GetProperties();

            foreach (PropertyInfo propertyInfo in properties)
            {
                statementObject.TrySetPropertyValue(propertyInfo.Name, propertyInfo.GetValue(statement));
            }
            return(Ok(statementObject));
        }
コード例 #22
0
        private EdmEntityObject CreateEdmEntity(IEdmEntityType entityType, dynamic row)
        {
            if (row == null)
                return null;

            var entity = new EdmEntityObject(entityType);
            IDictionary<string, object> propertyMap = row as IDictionary<string, object>;

            if (propertyMap != null)
            {
                foreach (var propertyPair in propertyMap)
                    entity.TrySetPropertyValue(propertyPair.Key, propertyPair.Value);
            }

            return entity;
        }
コード例 #23
0
        private EdmEntityObject CreateEdmEntity(IEdmEntityType entityType, IDictionary <string, object> rows, Dictionary <string, ComponentHelpClass> columnMap)
        {
            if (rows == null)
            {
                return(null);
            }

            var entity = new EdmEntityObject(entityType);

            foreach (var o in rows)
            {
                if (o.Key.Contains(_separator) == false)
                {
                    entity.TrySetPropertyValue(o.Key, o.Value);
                }
                else
                {
                    ParseComponent(entity, columnMap[o.Key], o.Value);
                }
            }

            return(entity);
        }
コード例 #24
0
        /// <summary>
        /// Десериализует navigation property.
        /// Также выполняет необходимые действия, чтобы обработка @odata.bind выполнялась по стандарту OData.
        /// </summary>
        /// <param name="entityResource">Объект, в который navigation property будет прочитано.</param>
        /// <param name="navigationLinkWrapper">navigation линк.</param>
        /// <param name="entityType">Тип сущности.</param>
        /// <param name="readContext">Состояние и установки, используемые при чтении.</param>
        public override void ApplyNavigationProperty(
            object entityResource,
            ODataNavigationLinkWithItems navigationLinkWrapper,
            IEdmEntityTypeReference entityType,
            ODataDeserializerContext readContext)
        {
            base.ApplyNavigationProperty(entityResource, navigationLinkWrapper, entityType, readContext);
            EdmEntityObject    edmEntity = (EdmEntityObject)entityResource;
            DataObjectEdmModel model     = readContext.Model as DataObjectEdmModel;

            foreach (var childItem in navigationLinkWrapper.NestedItems)
            {
                if (!readContext.Request.Properties.ContainsKey(Dictionary))
                {
                    readContext.Request.Properties.Add(Dictionary, new Dictionary <string, object>());
                }

                var dictionary             = (Dictionary <string, object>)readContext.Request.Properties[Dictionary];
                var navigationPropertyName = navigationLinkWrapper.NavigationLink.Name;
                var entityReferenceLink    = childItem as ODataEntityReferenceLinkBase;

                if (entityReferenceLink != null)
                {
                    Uri referencedEntityUrl = entityReferenceLink.EntityReferenceLink.Url;
                    if (referencedEntityUrl.IsAbsoluteUri)
                    {
                        referencedEntityUrl = referencedEntityUrl.MakeRelativeUri(readContext.Request.RequestUri);
                    }

                    var segments = referencedEntityUrl.OriginalString.Split(new[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries);
                    if (segments.Length != 2)
                    {
                        throw new ApplicationException($"Invalid @odata.bind: {referencedEntityUrl.OriginalString}");
                    }

                    var type = model.GetDataObjectType(segments[0]);
                    if (type == null)
                    {
                        throw new ApplicationException($"Invalid entity set: {segments[0]}");
                    }

                    Guid guid;
                    try
                    {
                        guid = new Guid(segments[1]);
                    }
                    catch (Exception)
                    {
                        throw new ApplicationException($"Invalid guid: {segments[1]}");
                    }

                    var linkedEdmEntity = new EdmEntityObject(model.GetEdmEntityType(type));
                    linkedEdmEntity.TrySetPropertyValue("__PrimaryKey", guid);
                    edmEntity.TrySetPropertyValue(navigationPropertyName, linkedEdmEntity);
                    if (!dictionary.ContainsKey(navigationPropertyName))
                    {
                        dictionary.Add(navigationPropertyName, navigationPropertyName);
                    }
                }

                var feed = childItem as ODataFeedWithEntries;
                if (childItem == null || (feed != null && feed.Entries.Count == 0))
                {
                    edmEntity.TrySetPropertyValue(navigationPropertyName, null);
                    if (!dictionary.ContainsKey(navigationPropertyName))
                    {
                        dictionary.Add(navigationPropertyName, null);
                    }
                }
            }
        }
コード例 #25
0
 public void Get(string key, EdmEntityObject entity)
 {
     entity.TrySetPropertyValue("Name", "Foo");
     entity.TrySetPropertyValue("ID", int.Parse(key));
 }
コード例 #26
0
 public void Get(string key, EdmEntityObject entity)
 {
     entity.TrySetPropertyValue("Name", "Foo");
     entity.TrySetPropertyValue("ID", int.Parse(key));
     entity.TrySetPropertyValue("School", Createchool(99, new DateTimeOffset(2016, 1, 19, 1, 2, 3, TimeSpan.Zero), entity.ActualEdmType));
 }
        protected virtual IEdmEntityObject BuildEdmEntityObject(Entity record, SavedQueryView view, IEnumerable <SavedQueryView.ViewColumn> viewColumns, EdmEntityTypeReference dataEntityTypeReference, EdmComplexTypeReference entityReferenceComplexTypeReference, EdmComplexTypeReference optionSetComplexTypeReference, string entityListIdString, string viewIdString)
        {
            if (record == null)
            {
                return(null);
            }

            var entityObject = new EdmEntityObject(dataEntityTypeReference);

            entityObject.TrySetPropertyValue(view.PrimaryKeyLogicalName, record.Id);

            foreach (var column in viewColumns)
            {
                var value = record.Attributes.Contains(column.LogicalName) ? record.Attributes[column.LogicalName] : null;

                if (value is AliasedValue)
                {
                    var aliasedValue = value as AliasedValue;
                    value = aliasedValue.Value;
                }

                if (column.Metadata == null)
                {
                    continue;
                }

                var propertyName = column.LogicalName;

                if (propertyName.Contains('.'))
                {
                    propertyName = string.Format("{0}-{1}", column.Metadata.EntityLogicalName, column.Metadata.LogicalName);
                }

                switch (column.Metadata.AttributeType)
                {
                case AttributeTypeCode.Money:
                    var     money      = value as Money;
                    decimal moneyValue = 0;
                    if (money != null)
                    {
                        moneyValue = money.Value;
                    }
                    entityObject.TrySetPropertyValue(propertyName, moneyValue);
                    break;

                case AttributeTypeCode.Customer:
                case AttributeTypeCode.Lookup:
                case AttributeTypeCode.Owner:
                    var entityReference = value as EntityReference;
                    if (entityReference == null)
                    {
                        continue;
                    }
                    var entityReferenceObject = new EdmComplexObject(entityReferenceComplexTypeReference);
                    entityReferenceObject.TrySetPropertyValue("Name", entityReference.Name);
                    entityReferenceObject.TrySetPropertyValue("Id", entityReference.Id);
                    entityObject.TrySetPropertyValue(propertyName, entityReferenceObject);
                    break;

                case AttributeTypeCode.State:
                    var stateOptionSet = value as OptionSetValue;
                    if (stateOptionSet == null)
                    {
                        continue;
                    }
                    var stateAttributeMetadata = column.Metadata as StateAttributeMetadata;
                    if (stateAttributeMetadata == null)
                    {
                        continue;
                    }
                    var stateOption = stateAttributeMetadata.OptionSet.Options.FirstOrDefault(o => o != null && o.Value != null && o.Value.Value == stateOptionSet.Value);
                    if (stateOption == null)
                    {
                        continue;
                    }
                    var stateLabel      = stateOption.Label.LocalizedLabels.FirstOrDefault(l => l.LanguageCode == LanguageCode) ?? stateOption.Label.GetLocalizedLabel();
                    var stateOptionName = stateLabel == null?stateOption.Label.GetLocalizedLabelString() : stateLabel.Label;

                    var stateOptionSetObject = new EdmComplexObject(optionSetComplexTypeReference);
                    stateOptionSetObject.TrySetPropertyValue("Name", stateOptionName);
                    stateOptionSetObject.TrySetPropertyValue("Value", stateOptionSet.Value);
                    entityObject.TrySetPropertyValue(propertyName, stateOptionSetObject);
                    break;

                case AttributeTypeCode.Picklist:
                    var optionSet = value as OptionSetValue;
                    if (optionSet == null)
                    {
                        continue;
                    }
                    var picklistAttributeMetadata = column.Metadata as PicklistAttributeMetadata;
                    if (picklistAttributeMetadata == null)
                    {
                        continue;
                    }
                    var option = picklistAttributeMetadata.OptionSet.Options.FirstOrDefault(o => o != null && o.Value != null && o.Value.Value == optionSet.Value);
                    if (option == null)
                    {
                        continue;
                    }
                    var label = option.Label.LocalizedLabels.FirstOrDefault(l => l.LanguageCode == LanguageCode) ?? option.Label.GetLocalizedLabel();
                    var name  = label == null?option.Label.GetLocalizedLabelString() : label.Label;

                    var optionSetObject = new EdmComplexObject(optionSetComplexTypeReference);
                    optionSetObject.TrySetPropertyValue("Name", name);
                    optionSetObject.TrySetPropertyValue("Value", optionSet.Value);
                    entityObject.TrySetPropertyValue(propertyName, optionSetObject);
                    break;

                case AttributeTypeCode.Status:
                    var statusOptionSet = value as OptionSetValue;
                    if (statusOptionSet == null)
                    {
                        continue;
                    }
                    var statusAttributeMetadata = column.Metadata as StatusAttributeMetadata;
                    if (statusAttributeMetadata == null)
                    {
                        continue;
                    }
                    var statusOption = statusAttributeMetadata.OptionSet.Options.FirstOrDefault(o => o != null && o.Value != null && o.Value.Value == statusOptionSet.Value);
                    if (statusOption == null)
                    {
                        continue;
                    }
                    var statusLabel      = statusOption.Label.LocalizedLabels.FirstOrDefault(l => l.LanguageCode == LanguageCode) ?? statusOption.Label.GetLocalizedLabel();
                    var statusOptionName = statusLabel == null?statusOption.Label.GetLocalizedLabelString() : statusLabel.Label;

                    var statusOptionSetObject = new EdmComplexObject(optionSetComplexTypeReference);
                    statusOptionSetObject.TrySetPropertyValue("Name", statusOptionName);
                    statusOptionSetObject.TrySetPropertyValue("Value", statusOptionSet.Value);
                    entityObject.TrySetPropertyValue(propertyName, statusOptionSetObject);
                    break;

                default:
                    entityObject.TrySetPropertyValue(propertyName, value);
                    break;
                }
                entityObject.TrySetPropertyValue("list-id", entityListIdString);
                entityObject.TrySetPropertyValue("view-id", viewIdString);
            }
            return(entityObject);
        }
コード例 #28
0
        public void SendAsync_WritesETagToResponseHeaders_InUntyped()
        {
            // Arrange
            IEdmModel model = GetUnTypeEdmModel();
            HttpRequestMessage request = SetupRequest(HttpMethod.Get, "Customers(3)", model);

            IEdmEntityType entityType = model.SchemaElements.OfType<IEdmEntityType>().First(c => c.Name == "Customer");
            EdmEntityObject customer = new EdmEntityObject(entityType);
            customer.TrySetPropertyValue("ID", 3);
            customer.TrySetPropertyValue("Name", "Sam");

            HttpResponseMessage originalResponse = SetupResponse(HttpStatusCode.OK, typeof(EdmEntityObject), customer);
            ETagMessageHandler handler = new ETagMessageHandler() { InnerHandler = new TestHandler(originalResponse) };

            // Act
            HttpResponseMessage response = handler.SendAsync(request).Result;

            // Assert
            Assert.NotNull(response.Headers.ETag);
            Assert.Equal("\"J1NhbSc=\"", response.Headers.ETag.Tag);
        }
コード例 #29
0
        public void AfterSavePostComplexObjectTest()
        {
            // TODO: переписать тест с корректным формированием параметра - передаваемой сущности - для Post.
            // Объекты для тестирования создания.
            Медведь медв = new Медведь {
                Вес = 48
            };
            Лес лес1 = new Лес {
                Название = "Бор"
            };
            Лес лес2 = new Лес {
                Название = "Березовая роща"
            };

            медв.ЛесОбитания = лес1;
            var берлога1 = new Берлога {
                Наименование = "Для хорошего настроения", ЛесРасположения = лес1
            };
            var берлога2 = new Берлога {
                Наименование = "Для плохого настроения", ЛесРасположения = лес2
            };

            медв.Берлога.Add(берлога1);
            медв.Берлога.Add(берлога2);

            // Объекты для тестирования создания с обновлением.
            Медведь медвежонок = new Медведь {
                Вес = 12
            };
            var берлога3 = new Берлога {
                Наименование = "Для хорошего настроения", ЛесРасположения = лес1
            };

            медвежонок.Берлога.Add(берлога3);

            ActODataService(args =>
            {
                args.Token.Events.CallbackAfterCreate = AfterCreate;
                args.Token.Events.CallbackAfterUpdate = AfterUpdate;
                args.Token.Events.CallbackAfterDelete = AfterDelete;

                // ------------------ Только создания объектов ------------------
                // Подготовка тестовых данных в формате OData.
                var controller         = new DataObjectController(args.DataService, args.Token.Model, args.Token.Events, args.Token.Functions);
                EdmEntityObject edmObj = controller.GetEdmObject(args.Token.Model.GetEdmEntityType(typeof(Медведь)), медв, 1, null);
                var edmЛес1            = controller.GetEdmObject(args.Token.Model.GetEdmEntityType(typeof(Лес)), лес1, 1, null);
                var edmЛес2            = controller.GetEdmObject(args.Token.Model.GetEdmEntityType(typeof(Лес)), лес2, 1, null);
                edmObj.TrySetPropertyValue("ЛесОбитания", edmЛес1);
                var coll = controller.GetEdmCollection(медв.Берлога, typeof(Берлога), 1, null);
                edmObj.TrySetPropertyValue("Берлога", coll);
                EdmEntityObject edmБерлога1 = (EdmEntityObject)coll[0]; // controller.GetEdmObject(args.ODataService.Model.GetEdmEntityType(typeof(Берлога)), берлога1, 1, null);
                EdmEntityObject edmБерлога2 = (EdmEntityObject)coll[1]; // controller.GetEdmObject(args.ODataService.Model.GetEdmEntityType(typeof(Берлога)), берлога2, 1, null);
                edmБерлога1.TrySetPropertyValue("ЛесРасположения", edmЛес1);
                edmБерлога2.TrySetPropertyValue("ЛесРасположения", edmЛес2);

                // Формируем URL запроса к OData-сервису.
                string requestUrl = string.Format("http://localhost/odata/{0}", args.Token.Model.GetEdmEntitySet(typeof(Медведь)).Name);

                ParamObj = null;

                // Обращаемся к OData-сервису и обрабатываем ответ, в теле запроса передаем создаваемый объект в формате JSON.
                HttpResponseMessage response = args.HttpClient.PostAsJsonAsync(requestUrl, edmObj).Result;
                Assert.NotNull(ParamObj);

                // Убедимся, что запрос завершился успешно.
                Assert.Equal(HttpStatusCode.Created, response.StatusCode);

                // Получим строку с ответом.
                string receivedJsonObjs = response.Content.ReadAsStringAsync().Result.Beautify();

                // В ответе приходит объект с созданной сущностью.
                // Преобразуем полученный объект в словарь.
                Dictionary <string, object> receivedObjs = new JavaScriptSerializer().Deserialize <Dictionary <string, object> >(receivedJsonObjs);

                // Проверяем созданный объект, вычитав с помощью DataService
                DataObject createdObj = new Медведь {
                    __PrimaryKey = медв.__PrimaryKey
                };
                args.DataService.LoadObject(createdObj);

                Assert.Equal(ObjectStatus.UnAltered, createdObj.GetStatus());
                Assert.Equal(((Медведь)createdObj).Вес, receivedObjs["Вес"]);

                // Проверяем что созданы все зависимые объекты, вычитав с помощью DataService
                var ldef         = ICSSoft.STORMNET.FunctionalLanguage.SQLWhere.SQLWhereLanguageDef.LanguageDef;
                var lcs          = LoadingCustomizationStruct.GetSimpleStruct(typeof(Лес), "ЛесE");
                lcs.LoadingTypes = new[] { typeof(Лес) };
                var dobjs        = args.DataService.LoadObjects(lcs);

                Assert.Equal(2, dobjs.Length);

                lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof(Берлога), "БерлогаE");
                lcs.LoadingTypes = new[] { typeof(Берлога) };

                // lcs.LimitFunction = ldef.GetFunction(ldef.funcEQ, new VariableDef(ldef.GuidType, SQLWhereLanguageDef.StormMainObjectKey), keyValue);
                dobjs = args.DataService.LoadObjects(lcs);
                Assert.Equal(2, dobjs.Length);

                // ------------------ Создание объекта и обновление связанных ------------------
                // Создаем нового медведя: в его мастере ЛесОбитания - лес1, но в нём изменим Название; в детейлы заберем от первого медведя  детейл2, изменив Название в мастере детейла.
                // Подготовка тестовых данных в формате OData.
                edmObj = controller.GetEdmObject(args.Token.Model.GetEdmEntityType(typeof(Медведь)), медвежонок, 1, null);
                edmObj.TrySetPropertyValue("ЛесОбитания", edmЛес1);
                edmЛес1.TrySetPropertyValue("Название", лес1.Название + "(обновл)");
                edmЛес2.TrySetPropertyValue("Название", лес2.Название + "(обновл)");
                медв.Берлога.Remove(берлога2);
                медвежонок.Берлога.Add(берлога2);
                coll = controller.GetEdmCollection(медвежонок.Берлога, typeof(Берлога), 1, null);
                edmObj.TrySetPropertyValue("Берлога", coll);
                edmБерлога1 = (EdmEntityObject)coll[0];
                edmБерлога2 = (EdmEntityObject)coll[1];
                edmБерлога1.TrySetPropertyValue("ЛесРасположения", edmЛес2);
                edmБерлога2.TrySetPropertyValue("ЛесРасположения", edmЛес1);

                ParamObj = null;

                // Обращаемся к OData-сервису и обрабатываем ответ, в теле запроса передаем создаваемый объект в формате JSON.
                response = args.HttpClient.PostAsJsonAsync(requestUrl, edmObj).Result;
                Assert.NotNull(ParamObj);

                // Убедимся, что запрос завершился успешно.
                Assert.Equal(HttpStatusCode.Created, response.StatusCode);

                // Проверяем созданный объект, вычитав с помощью DataService
                createdObj = new Медведь {
                    __PrimaryKey = медвежонок.__PrimaryKey
                };
                args.DataService.LoadObject(createdObj);

                Assert.Equal(ObjectStatus.UnAltered, createdObj.GetStatus());
                Assert.Equal(12, ((Медведь)createdObj).Вес);

                // Проверяем что созданы все зависимые объекты, вычитав с помощью DataService
                ldef              = ICSSoft.STORMNET.FunctionalLanguage.SQLWhere.SQLWhereLanguageDef.LanguageDef;
                lcs               = LoadingCustomizationStruct.GetSimpleStruct(typeof(Лес), "ЛесE");
                lcs.LoadingTypes  = new[] { typeof(Лес) };
                lcs.LimitFunction = ldef.GetFunction(
                    ldef.funcEQ,
                    new ICSSoft.STORMNET.FunctionalLanguage.VariableDef(ldef.GuidType, ICSSoft.STORMNET.FunctionalLanguage.SQLWhere.SQLWhereLanguageDef.StormMainObjectKey),
                    лес1.__PrimaryKey);
                dobjs = args.DataService.LoadObjects(lcs);

                Assert.Equal(1, dobjs.Length);
                Assert.True(((Лес)dobjs[0]).Название.EndsWith("(обновл)"));

                lcs.LimitFunction = ldef.GetFunction(
                    ldef.funcEQ,
                    new ICSSoft.STORMNET.FunctionalLanguage.VariableDef(ldef.GuidType, ICSSoft.STORMNET.FunctionalLanguage.SQLWhere.SQLWhereLanguageDef.StormMainObjectKey),
                    лес2.__PrimaryKey);
                dobjs = args.DataService.LoadObjects(lcs);

                Assert.Equal(1, dobjs.Length);
                Assert.True(((Лес)dobjs[0]).Название.EndsWith("(обновл)"));

                lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof(Берлога), "БерлогаE");
                lcs.LoadingTypes  = new[] { typeof(Берлога) };
                lcs.LimitFunction = ldef.GetFunction(
                    ldef.funcEQ,
                    new ICSSoft.STORMNET.FunctionalLanguage.VariableDef(ldef.GuidType, "Медведь"),
                    медв.__PrimaryKey);
                dobjs = args.DataService.LoadObjects(lcs);

                Assert.Equal(1, dobjs.Length);

                lcs.LimitFunction = ldef.GetFunction(
                    ldef.funcEQ,
                    new ICSSoft.STORMNET.FunctionalLanguage.VariableDef(ldef.GuidType, "Медведь"),
                    медвежонок.__PrimaryKey);
                dobjs = args.DataService.LoadObjects(lcs);

                Assert.Equal(2, dobjs.Length);

                // Вернем детейл для того, чтобы тест работал со следующими СУБД.
                медвежонок.Берлога.Remove(берлога2);
                медв.Берлога.Add(берлога2);
            });
        }
コード例 #30
0
        public IHttpActionResult Get()
        {
            IEdmModel model = Request.ODataProperties().Model;
            IEdmEntityType customerType = model.SchemaElements.OfType<IEdmEntityType>().First(e => e.Name == "Customer");

            EdmEntityObject customer = new EdmEntityObject(customerType);

            customer.TrySetPropertyValue("Id", 1);
            customer.TrySetPropertyValue("Tony", 1);

            EdmEntityObjectCollection customers =
                new EdmEntityObjectCollection(
                    new EdmCollectionTypeReference(new EdmCollectionType(customerType.ToEdmTypeReference(false))));
            customers.Add(customer);
            return Ok(customers);

        }
コード例 #31
0
        public ParseContext Parse(ODataUriParser parser, ParseContext sourceParseContext)
        {
            //Select implementation
            var targetParseContext            = new ParseContext();
            var targetQueryableSourceEntities = new List <Dictionary <string, object> >();
            var sourceEdmSetting = sourceParseContext.EdmEntityTypeSettings.FirstOrDefault();
            var targetEdmSetting = new EdmEntityTypeSettings()
            {
                RouteName  = SelectParser,
                Personas   = sourceEdmSetting.Personas,
                Properties = new List <EdmEntityTypePropertySetting>()
            };
            var selectExpandClause    = parser.ParseSelectAndExpand();
            var edmEntityType         = new EdmEntityType(EdmNamespaceName, SelectParser);
            var latestStateDictionary = new Dictionary <string, object>();

            //Construct the types. For now we support non-nested primitive types only. Everything else is an exception for now.
            var propertyList = new List <string>();

            foreach (var item in selectExpandClause.SelectedItems)
            {
                switch (item)
                {
                case PathSelectItem pathSelectItem:
                    IEnumerable <ODataPathSegment> segments = pathSelectItem.SelectedPath;
                    var firstPropertySegment = segments.FirstOrDefault();
                    if (firstPropertySegment != null)
                    {
                        var typeSetting = sourceEdmSetting.Properties.FirstOrDefault(predicate => predicate.PropertyName == firstPropertySegment.Identifier);

                        propertyList.Add(firstPropertySegment.Identifier);

                        if (typeSetting.GetEdmPrimitiveTypeKind() != EdmPrimitiveTypeKind.None)
                        {
                            var edmPrimitiveType = typeSetting.GetEdmPrimitiveTypeKind();
                            if (typeSetting.IsNullable.HasValue)
                            {
                                edmEntityType.AddStructuralProperty(firstPropertySegment.Identifier, edmPrimitiveType, typeSetting.IsNullable.Value);
                            }
                            else
                            {
                                edmEntityType.AddStructuralProperty(firstPropertySegment.Identifier, edmPrimitiveType);
                            }
                            targetEdmSetting.Properties.Add(new EdmEntityTypePropertySetting
                            {
                                PropertyName = typeSetting.PropertyName,
                                PropertyType = typeSetting.PropertyType,
                                IsNullable   = typeSetting.IsNullable
                            });
                        }
                        else
                        {
                            //We are doing $select on a property which is of type list. Which means
                            if (typeSetting.PropertyType == "List")
                            {
                                var edmComplexType = GetEdmComplexTypeReference(sourceParseContext);
                                edmEntityType.AddStructuralProperty(typeSetting.PropertyName, new EdmCollectionTypeReference(new EdmCollectionType(new EdmComplexTypeReference(edmComplexType, true))));
                                targetEdmSetting.Properties.Add(new EdmEntityTypePropertySetting
                                {
                                    PropertyName = typeSetting.PropertyName,
                                    PropertyType = typeSetting.PropertyType,
                                    IsNullable   = typeSetting.IsNullable
                                });
                            }
                            else
                            {
                                throw new FeatureNotSupportedException(SelectParser, $"Invalid Custom Selection-{typeSetting.PropertyName}-{typeSetting.PropertyType}");
                            }
                        }
                    }
                    else
                    {
                        throw new FeatureNotSupportedException(SelectParser, "Empty Path Segments");
                    }
                    break;

                case WildcardSelectItem wildcardSelectItem: throw new FeatureNotSupportedException(SelectParser, "WildcardSelect");

                case ExpandedNavigationSelectItem expandedNavigationSelectItem: throw new FeatureNotSupportedException(SelectParser, "ExpandedNavigation");

                case ExpandedReferenceSelectItem expandedReferenceSelectItem: throw new FeatureNotSupportedException(SelectParser, "ExpandedReference");

                case NamespaceQualifiedWildcardSelectItem namespaceQualifiedWildcardSelectItem: throw new FeatureNotSupportedException(SelectParser, "NamespaceQualifiedWildcard");
                }
            }

            //Register these dynamic types to model
            sourceParseContext.Model.AddElement(edmEntityType);
            ((EdmEntityContainer)sourceParseContext.Model.EntityContainer).AddEntitySet("Select", edmEntityType);


            //Construct the data
            var entityReferenceType         = new EdmEntityTypeReference(edmEntityType, true);
            var collectionRef               = new EdmCollectionTypeReference(new EdmCollectionType(entityReferenceType));
            var collection                  = new EdmEntityObjectCollection(collectionRef);
            var filteredQueryableEntityList = sourceParseContext.QueryableSourceEntities.Select(p => p.Where(p => propertyList.Contains(p.Key)));

            latestStateDictionary.Add(RequestFilterConstants.GetEntityTypeKeyName(SelectParser, StepIndex), entityReferenceType);

            foreach (var entity in filteredQueryableEntityList)
            {
                var entityDictionary = new Dictionary <string, object>();
                var obj = new EdmEntityObject(edmEntityType);
                foreach (var propertyKey in propertyList)
                {
                    var setting = targetEdmSetting.Properties.FirstOrDefault(predicate => predicate.PropertyName.Equals(propertyKey));
                    var data    = entity.FirstOrDefault(property => property.Key.Equals(propertyKey));

                    //This condition is when the type of selected property is a primitive type
                    if (setting.GetEdmPrimitiveTypeKind() != EdmPrimitiveTypeKind.None)
                    {
                        var propertyValue = !data.Equals(default(KeyValuePair <string, object>)) ? data.Value : null;
                        obj.TrySetPropertyValue(propertyKey, propertyValue);
                        entityDictionary.Add(propertyKey, propertyValue);
                    }
                    else
                    {
                        switch (setting.PropertyType)
                        {
                        case "List":
                            //TODO: There is scope for perf improvement
                            //We can re-use the previous constructed list instead of constructing one from scratch.
                            var subList        = (List <Dictionary <string, object> >)data.Value;
                            var subListContext = GetList(subList, GetEdmComplexTypeReference(sourceParseContext));
                            obj.TrySetPropertyValue(propertyKey, subListContext.Result);
                            entityDictionary.Add(propertyKey, subListContext.QueryAbleResult);
                            break;
                        }
                    }
                }
                collection.Add(obj);
                targetQueryableSourceEntities.Add(entityDictionary);
            }

            targetParseContext.Result = collection;
            targetParseContext.QueryableSourceEntities = targetQueryableSourceEntities;
            targetParseContext.Model = sourceParseContext.Model;
            targetParseContext.EdmEntityTypeSettings = new List <EdmEntityTypeSettings> {
                targetEdmSetting
            };
            targetParseContext.LatestStateDictionary = latestStateDictionary;
            return(targetParseContext);
        }
コード例 #32
0
 public void Get(string key, EdmEntityObject entity)
 {
     entity.TrySetPropertyValue("Name", "abc");
     entity.TrySetPropertyValue("ID", int.Parse(key));
     entity.TrySetPropertyValue("DetailInfo", CreateDetailInfo(88, "abc_detailinfo", entity.ActualEdmType));
 }