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

Handle untyped collections in context's getedmtype method #1607

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mtroth-microsoft
Copy link
Contributor

*This pull request fixes issue #1597

Description

I could find no alternative to resolve a query using the ODataResourceSetSerializer than including the block of code that I have added to the ODataSerializerContext.GetEdmType method. Given that the method is called by the WriteObject method in the ResourceSet Serializer, please explain how to make that call succeed when a collection of EdmEntityObject or EdmComplexObject is provided given the remainder of the logic in the method. Note that I am producing the IEdmModel by directly consuming the csdl generated by a tool.

@@ -161,6 +163,22 @@ internal IEdmTypeReference GetEdmType(object instance, Type type)
typeof(IEdmObject).Name);
}
}
else if (typeof(IEnumerable).IsAssignableFrom(type) &&
typeof(IEdmObject).IsAssignableFrom(type.GetGenericArguments().FirstOrDefault()))
Copy link
Member

@xuzhg xuzhg Sep 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Web API recommends to use "EdmEnittyObjectCollection, EdmComplexObjectCollection, EdmEnumObjectCollection" for the collection. #WontFix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my approach is consistent with the approaches used in this class and others in webapi.


In reply to: 215081845 [](ancestors = 215081845)

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.

3 participants