Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the build-in abstract types for the core model #1032

Closed
wants to merge 1 commit into from

Conversation

xuzhg
Copy link
Member

@xuzhg xuzhg commented Jan 9, 2018

Issues

*See Issue: #1027

Description

OData spec says at: http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Built-In_Abstract_Types

The following built-in abstract types can be used within a model:
· Edm.PrimitiveType
· Edm.ComplexType
· Edm.EntityType

Vocabulary terms can, in addition, use
· Edm.AnnotationPath
· Edm.PropertyPath
· Edm.NavigationPropertyPath

However, the current implementation doesn't include this part. It will make the model validation failed. Show as #1027

Note:

It's not a checkin-able PR. it's just for discuss about the design and implementation about the abstract type. So, don't care about the wrong comments and not correct test cases.


Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

@xuzhg
Copy link
Member Author

xuzhg commented Jan 10, 2018

@mikepizzo Can we discuss it in next Monday's meeting?

@xuzhg
Copy link
Member Author

xuzhg commented Jan 24, 2018

More context:

We can't define the Edm Term with the correct type if we don't define the above abstract type.

For example:

I want to call:

EdmModel model = new EdmModel();
EdmComplexType complexType = new EdmComplexType("NS", "SelectType");
complexType.AddStructuralProperty("DefaultSelect", new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(true))));
complexType.AddStructuralProperty("DefaultHidden", new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(true))));
model.AddElement(complexType);
EdmTerm term = new EdmTerm("NS", "MyTerm", new EdmComplexTypeReference(complexType, true));
model.AddElement(term);

We can get:

<Schema Namespace="NS" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <ComplexType Name="SelectType">
             <Property Name="DefaultSelect" Type="Collection(Edm.String)" />
             <Property Name="DefaultHidden" Type="Collection(Edm.String)" />
      </ComplexType>
     <Term Name="MyTerm" Type="NS.SelectType" />
</Schema>

We can't define the Type as "Collection(Edm.NavigationPropertyPath)"

@xuzhg xuzhg force-pushed the NavigationPropertyPath branch 2 times, most recently from e474eef to dcb24d8 Compare January 26, 2018 03:06
1. Edm.ComplexType
2. Edm.EntityType
3. Edm.PrimitiveType
4. Edm.*Path, include Edm.AnnotationPath, Edm.PropertyPath,
Edm.NavigationPropertyPath
@xuzhg
Copy link
Member Author

xuzhg commented Jan 26, 2018

Discussion done. Close it. Will file a new PR.

@xuzhg xuzhg closed this Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant