Fix EdmStructuredObject default value getter#1949
Fix EdmStructuredObject default value getter#1949adzhilyanov wants to merge 1 commit intoOData:masterfrom
Conversation
| (isCollection && propertyType.AsCollection().ElementType().IsPrimitive())) | ||
| { | ||
| // primitive or primitive collection | ||
| if (clrType == typeof(string)) |
There was a problem hiding this comment.
Edm.Primitive (System.String) is a built-in Primitive type.
EdmStructuredObject is used for complex or entity instance, the type of them is structured type. So, I don't know why should we add "primitive type" into "structured type"?
There was a problem hiding this comment.
Hey, maybe the title is a bit misleading. It should be something like 'Fix EdmStructuredObject's properties default value getter'.
You are correct, but the EdmStructuredObject has properties, which can be primitives. So when you try to get a property from the EdmStructuredObject, if the property does not exist, a default value is returned. This PR aimed to fix how the default value for a property is obtained - fixing the GetDefaultValue method (which is used from TryGetPropertyValue). I don't know if this is the right place for the GetDefaultValue though.
Issues
Activator.CreateInstance(clrType)does not work whenclrTypeisSystem.StringorSystem.Byte[](System.MissingMethodException : No parameterless constructor defined for this object.) which are mapped toEdm.StringandEdm.Binary.Description
Return empty string when the type is
Edm.String[Nullable=False]and empty array when the type isEdm.Binary[Nullable=False].Checklist (Uncheck if it is not completed)
Additional work necessary
Not sure what to do about
Edm.Stream,Edm.Geography**andEdm.Geometry**properties.