Skip to content

Commit

Permalink
Create type annotation only has the type name
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhg committed Jan 31, 2022
1 parent 4f537fa commit 4721f7a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ internal static void AddTypeNameAnnotationAsNeeded(ODataPrimitiveValue primitive
typeName = primitiveType.FullName();
}

primitive.TypeAnnotation = new ODataTypeAnnotation(typeName);
if (typeName != null)
{
primitive.TypeAnnotation = new ODataTypeAnnotation(typeName);
}
}

internal static ODataPrimitiveValue CreatePrimitive(object value, IEdmPrimitiveTypeReference primitiveType,
Expand Down
82 changes: 42 additions & 40 deletions src/Microsoft.AspNetCore.OData/Microsoft.AspNetCore.OData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5659,7 +5659,17 @@
<summary>
Gets the value of the property with the given name.
</summary>
ft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject.#ctor(Microsoft.OData.Edm.IEdmComplexTypeReference)">
<param name="propertyName">The name of the property to get.</param>
<param name="value">When this method returns, contains the value of the property with the given name, if the property is found;
otherwise, null. The parameter is passed uninitialized.</param>
<returns><c>true</c> if the instance contains the property with the given name; otherwise, <c>false</c>.</returns>
</member>
<member name="T:Microsoft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject">
<summary>
Represents an <see cref="T:Microsoft.AspNetCore.OData.Formatter.Value.IEdmComplexObject"/> that is null.
</summary>
</member>
<member name="M:Microsoft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject.#ctor(Microsoft.OData.Edm.IEdmComplexTypeReference)">
<summary>
Initializes a new instance of the <see cref="T:Microsoft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject"/> class.
</summary>
Expand Down Expand Up @@ -6468,18 +6478,6 @@
Looks up a localized string similar to Cannot find key &apos;{0}&apos; in the &apos;{1}&apos; type..
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.SRResources.CannotFindParameterInOperation">
<summary>
Looks up a localize.AspNetCore.OData.SRResources.CannotDeserializeUnknownProperty">
<summary>
Looks up a localized string similar to The property &apos;{0}&apos; does not exist on type &apos;{1}&apos;. Make sure to only use property names that are defined by the type..
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.SRResources.CannotFindKeyInEntityType">
<summary>
Looks up a localized string similar to Cannot find key &apos;{0}&apos; in the &apos;{1}&apos; type..
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.SRResources.CannotFindParameterInOperation">
<summary>
Looks up a localized string similar to Cannot find parameter &apos;{0}&apos; is in the operation &apos;{1}&apos;..
Expand Down Expand Up @@ -10734,7 +10732,23 @@
Gets the raw $select query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQuery <summary>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.Expand">
<summary>
Gets the raw $expand query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.Count">
<summary>
Gets the raw $count query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.Format">
<summary>
Gets the raw $format query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.SkipToken">
<summary>
Gets the raw $skiptoken query value from the incoming request Uri if exists.
</summary>
</member>
Expand Down Expand Up @@ -11081,15 +11095,6 @@
<param name="queryOptions">Information about the other query options.</param>
<returns>The new <see cref="T:System.Linq.IQueryable"/> after the skiptoken query has been applied to.</returns>
</member>
<member name="M:Microsoft.AspNetCore.OData.Query.SkipTokenQueryOption.ApplyTo(System.Linq.IQueryable,Microsoft.AspNetCore.OData.Query.ODataQuerySettings,Microsoft.AspNetCore.OData.Query.ODataQueryOptions)">
<summary>
Apply the $skiptoken query to the given IQueryable.
</summary>
<param name="query">The original <see cref="T:System.Linq.IQueryable"/>.</param>
<param name="querySettings">The query settings to use while applyingn.</param>
<param name="queryOptions">Information about the other query options.</param>
<returns>The new <see cref="T:System.Linq.IQueryable"/> after the skiptoken query has been applied to.</returns>
</member>
<member name="M:Microsoft.AspNetCore.OData.Query.SkipTokenQueryOption.ApplyTo(System.Linq.IQueryable,Microsoft.AspNetCore.OData.Query.ODataQuerySettings,Microsoft.AspNetCore.OData.Query.ODataQueryOptions)">
<summary>
Apply the $skiptoken query to the given IQueryable.
Expand Down Expand Up @@ -13275,7 +13280,20 @@
Initializes a new instance of the <see cref="T:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate" /> class.
</summary>
<param name="actionImport">The wrapper action import.</param>
<param name="navigationSource">The target navigation sNetCore.OData.Routing.Template.ActionImportSegmentTemplate.Segment">
<param name="navigationSource">The target navigation source. it could be null.</param>
</member>
<member name="M:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate.#ctor(Microsoft.OData.UriParser.OperationImportSegment)">
<summary>
Initializes a new instance of the <see cref="T:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate" /> class.
</summary>
<param name="segment">The operation import segment.</param>
</member>
<member name="P:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate.ActionImport">
<summary>
Gets the wrapped action import.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate.Segment">
<summary>
Gets the action import segment.
</summary>
Expand Down Expand Up @@ -14084,19 +14102,3 @@
</member>
</members>
</doc>
ummary>
<param name="segment">The value segment.</param>
</member>
<member name="P:Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.Segment">
<summary>
Gets the value segment.
</summary>
</member>
<member name="M:Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.GetTemplates(Microsoft.AspNetCore.OData.Routing.ODataRouteOptions)">
<inheritdoc />
</member>
<member name="M:Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.TryTranslate(Microsoft.AspNetCore.OData.Routing.Template.ODataTemplateTranslateContext)">
<inheritdoc />
</member>
</members>
</doc>
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public async Task PatchOpenComplexTypeProperty(string mode)
response = await client.SendAsync(request);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
content = await response.Content.ReadAsObject<JObject>();
Assert.Equal(6, content.Count); // @odata.context + 3 declared properties + 1 dynamic properties + 1 new dynamic properties
Assert.Equal(7, content.Count); // @odata.context + 3 declared properties + 2 dynamic properties + 1 new dynamic properties
Assert.Equal("NewCity", content["City"]); // updated
Assert.Equal("1 Microsoft Way", content["Street"]);
Assert.Equal("US", content["CountryCode"]);
Expand Down Expand Up @@ -587,7 +587,7 @@ public async Task PutOpenComplexTypeProperty(string mode)
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
content = await response.Content.ReadAsObject<JObject>();
Assert.Equal(5, content.Count); // @odata.context + 3 declared properties + 1 new dynamic properties
Assert.Equal(6, content.Count); // @odata.context + 3 declared properties + 2 new dynamic properties
Assert.Equal("NewCity", content["City"]); // updated
Assert.Equal("NewStreet", content["Street"]); // updated
Assert.Equal("US", content["CountryCode"]);
Expand Down

0 comments on commit 4721f7a

Please sign in to comment.