MissingMethodException on getting ResourceInstance from ODataResourceSerializer#2558
MissingMethodException on getting ResourceInstance from ODataResourceSerializer#2558komdil wants to merge 495 commits into
Conversation
(OData#1560) * Don't assume port 80 when generating nextLink in ASP.NET Core OData#1559 If the port isn't set on `request.Host`, port 80 was assumed previously. If the app is running behind a reverse proxy, and the port was not forwarded, this can result in invalid URLs - for example an https URL using port 80 Instead, we just omit the port completely if it's not explictly set. * Add unit tests for GetNextPageLink * Add copyright notice
…#1588) - Null check on ODataQueryParameterBindingAttribute for Net Core
This is a regression from 5.x to 6.x/7.x. It looks like the original fix was never merged to the 6.0 development branch. Issue: OData#736
- Add comma before MyLevel property.
This is addresses the unhelpful error message described in this GitHub issue: OData#1421
Improving the error message for when an unknown property is deserialized
…a#1628) * Enable adding members to collection of complex types * Fix deserialization for primitive types The ODataPrimitiveDeserializer did not support non-trivial (that cannot be cast directly from the string representation) primitive types like Binary, GUIDS, Spatial etc. * Support cast uri as well * Pass the type reference to ODL to parse correctly * Do not use ConvertPrimitiveValue, add unit test for ODataPrimitiveDeserializer * Fix unit tests * Add unit tests for propertyrouting changes * Undo unnecessary changes * Add E2E test for PostToCollections Add E2E test for PostToCollections * typo * E2E case for collection of Enums * Keep original and add another testcase * Account for the additional property on the test cases * Add test cases for Binary and Guids * Make the private helper functions for Enum deserialization tests accessible for other classes * New E2E cases for posting to collection of complex type with inheritance * Add more test cases for trivial primitive values * Add a new date time object to a collection property * Do not imply unique identifiers * Change the response from Created to Ok to avoid exception, response is yet to be discussed * fix spacing errors * Fix Unit test * Remove test case for the time being because of difference in behavior locally and on server * Address self reviewed issues * Improve the enum test case * Address Sam's comments on the PR * remove extra whitespace * Add testcase to return representation * Add using to Netcore as well * Address more PR comments * Address last of the PR comments
1. Update the Microsoft.Data.OData vulnerability to 5.8.4 2. Update the Microsoft.AspNetCore.All to 2.0.9 3. Update the Microsoft.AspNetCore.Server.Kestrel.* to 2.0.4
* Allow ODataFeature.TotalCount set to null. * CR update: set this.totalCountSet = value.HasValue.
* Respect preference header for specifying maxpagesize * Don't set pagesize in the enable query code; instead wait till options to maintain parity * Fix single get request issue * Revert "Merge branch 'Respect-preference-header-for-paging' of https://github.com/KanishManuja-MS/WebApi into Respect-preference-header-for-paging" This reverts commit 14a45de, reversing changes made to 338d857. * Update src/Microsoft.AspNet.OData.Shared/RequestPreferenceHelpers.cs * Fix for classic version * fix aspnet oddities * Update src/Microsoft.AspNet.OData.Shared/RequestPreferenceHelpers.cs * Use String instead of string to avoid performance build error * Address PR comments * Update src/Microsoft.AspNet.OData.Shared/RequestPreferenceHelpers.cs * Fix spacing
…Data#1618) * Take and Top query use wrong Provider.CreateQuery Method OData#1617 * Bugfix: Cast to IProviderInterface before scanning for the methods * Based on review feedback, method searching is now cached
* For individual query options, pass in the container so that global config is available. * CR comments.
* Update src/Microsoft.AspNetCore.OData/Extensions/ODataApplicationBuilderExtensions.cs * Update public API bsl
…le without key defined on its type (OData#1641)
|
I couldn't solve the tests. I think someone needs to take a look. Send query https://localhost:5001/oData/Student?$select=Id,FirstName It will throw exception from DeserializationHelpers.SetProperty(resource, propertyName, value); 261 line ResourceContext.cs @xuzhg I think these changes were made by you. |
KenitoInc
left a comment
There was a problem hiding this comment.
It seems this PR is addressing a specific use case for you.
In the next release of WebApi Aspnetcore v8.x, we will have the ability to inject a custom implementation of the SelectExpandBinder (PR). That should work for you.
Maybe, but I am using v7.x. Is it possible to merge that branch in version 7.x also? |
@xuzhg @gathogojr What do you think? |
I am seeing Activator.CreateInstanse on BuildResource method on v.8x also. I think the problem exists on v.8x also |
| Expression.Constant(_modelID); | ||
| wrapperTypeMemberAssignments.Add(Expression.Bind(wrapperProperty, wrapperPropertyValueExpression)); | ||
|
|
||
| bool instanseOfWrapperClassWasSet = false; |
There was a problem hiding this comment.
super nit: spelling "instance"
|
|
||
| // Assert | ||
| IEnumerator enumerator = queryable.GetEnumerator(); | ||
| IEnumerator _querableEnumerator = _queryable.GetEnumerator(); |
There was a problem hiding this comment.
IEnumerator implements IDisposable. Please wrap this in a using block
| return Expression.MemberInit(Expression.New(wrapperType), wrapperTypeMemberAssignments); | ||
|
|
||
| if (instanseOfWrapperClassWasSet) | ||
| return Expression.MemberInit(Expression.New(wrapperType), wrapperTypeMemberAssignments); |
There was a problem hiding this comment.
as per code guidelines, please enclose body of conditional in braces (even if it's a single line). Improves code readability and reduces introducing logical errors later.
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
@komdil Can you please look at the review comments., thanks |
@Sreejithpin The tests are failing. It looks this solution will not work for solving this problem. I don't have next steps |
|
@komdil, I'd like to help out and take a look, but it seems that I can't kick off a new build. Do you mind re-running the checks? |
|
@komdil
$it => new SelectSome`1()
{
ModelID = value(Microsoft.AspNet.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]).TypedProperty,
Container = new NamedPropertyWithNext0`1()
{
Name = "Title",
Value = $it.Title,
Next0 = new AutoSelectedNamedProperty`1()
{
Name = "Id",
Value = Convert($it.Id, Nullable`1)
}
}
}
$it => new SelectAll`1() {
ModelID = value(Microsoft.AspNet.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]).TypedProperty,
Instance = $it,
UseInstanceForProperties = True
}
}
$it => new SelectAllAndExpand`1()
{
ModelID = value(Microsoft.AspNet.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]).TypedProperty,
Instance = $it,
UseInstanceForProperties = True,
Container = new NamedProperty`1()
{
Name = "Authors",
Value = $it.Authors.Select($it => new SelectAll`1()
{
ModelID = value(Microsoft.AspNet.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.String]).TypedProperty,
Instance = $it,
UseInstanceForProperties = True
}
)
}
}We don't set the Your PR introduces an Instance property in all scenarios. |
4c43a84 to
ddfd3dd
Compare
Issues
This pull request fixes issue #2557.
Description
Adding constructor param on generic SelectExpandWrapper class for setting instance of resource
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.