EdmEntityType productType = new EdmEntityType("ns", "Product"); productType.AddKeys(productType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32)); productType.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String); edmModel.AddElement(productType);
EdmComplexType addressType = new EdmComplexType("ns", "Address"); addressType.AddStructuralProperty("Street", EdmPrimitiveTypeKind.String); addressType.AddStructuralProperty("City", EdmPrimitiveTypeKind.String); addressType.AddStructuralProperty("State", EdmPrimitiveTypeKind.String); addressType.AddStructuralProperty("ZipCode", EdmPrimitiveTypeKind.String); edmModel.AddElement(addressType);In this example, we define a new complex type called Address with four properties: Street, City, State, and ZipCode. We then add this complex type to the conceptual model using the AddElement method. Package library: Microsoft.OData.Edm.Library.