-
Notifications
You must be signed in to change notification settings - Fork 473
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
PR For Bulk Operation and ODataBind Review for Beta Release #2567
base: master
Are you sure you want to change the base?
Conversation
/// Handler Class to handle users methods for create, delete and update. | ||
/// This is the handler for data modification where there is no CLR type. | ||
/// </summary> | ||
public abstract class EdmODataAPIHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This is the default Patch Handler for non CLR type. This calss has default Get, Create and Update | ||
/// and will do these actions. This will be used when the original collection to be Patched is provided. | ||
/// </summary> | ||
internal class DefaultEdmODataAPIHandler : EdmODataAPIHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we dont have any DefaultEdmPatchMethodHandler
we have 2 defaults, 1 for typed another for typeles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was confused because the name of the file was still "DefaultEdmPatchMethodHandler"
/// <summary> | ||
/// Navigation Path of an OData ID | ||
/// </summary> | ||
public class NavigationPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ODL has ODataExpandPath and ODataSelectPath, does it can meet your requirement?
private ConcurrentDictionary<string, PathItem[]> _pathItemCache = new ConcurrentDictionary<string, PathItem[]>(); | ||
|
||
/// <summary> | ||
/// Constructor which takes and odataId and creates PathItems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check other class:
mainly use the sentence like: "Initializes a new instance of the class."
/// <summary> | ||
/// If the item is a cast segment, Name of the Path Item (eg: derived entity name, entity set name) | ||
/// </summary> | ||
public string CastTypeName { internal set; get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would have different values, one generic and another the cast type name think it could be used by developer for generic case and then specific cast case, eg: Name = NewFriends, CastTypeName = Microsoft.Test.E2E.AspNet.OData.BulkInsert.MyNewFriend
/// <summary> | ||
/// Whether the PathItem is a cast segment | ||
/// </summary> | ||
public bool IsCastType { internal set; get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <summary> | ||
/// List of Key properties of that entity | ||
/// </summary> | ||
public Dictionary<string, object> KeyProperties { internal set; get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
navigationPathName = navigationPath; | ||
_pathSegments = pathSegments; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have a public constructor that takes both string and parsed form? when would a developer use this? When would we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pathitems is already parsed in the deserializer by calling pathhandler.parse (for odata bind its already written by elizabeth) so wanteed to reuse it and not call it again , thats why used both in constructor
@@ -0,0 +1,98 @@ | |||
// Copyright (c) Microsoft Corporation. All rights reserved. | |||
// Licensed under the MIT License. See License.txt in the project root for license information. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the head since we moved to .NET Foundation #Resolved
public NavigationPath(string navigationPath, ReadOnlyCollection<ODataPathSegment> pathSegments) | ||
{ | ||
navigationPathName = navigationPath; | ||
_pathSegments = pathSegments; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need the paramater null check #Resolved
/// </summary> | ||
public class NavigationPath | ||
{ | ||
private string navigationPathName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have the default constructor?
And if we do have this, if customers use it, _pathSegments is not initializated? #Resolved
} | ||
|
||
return pathItems; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method looks werid.
It looks to retrieve a PathItem[] using a path name, but, the path name is private field? It's not from "outside". Straigh?
In this case, why do we need a ConcurrencyDictionary?
#Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was introduced to handle multiple set of path items in the same path like customers(1)/Orders(1)/shipment(1) and customers(1)/Orders(1)/Address(1). so cache customes(1)/orders(1) not to call again . But since we are making seperate navigation paths for each object it wouldnt be ideal to keep a cache. Might be in later versions we can consider a centralizzed caching if we see such scenarios, even then we should think of heavy cache allocations . So removing it for now
|
||
|
||
/// <summary> | ||
/// NavigationPath/ODataId in string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
if (segment is EntitySetSegment || segment is NavigationPropertySegment) | ||
{ | ||
pathItems.Add(new PathItem()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for complex property. type cast is handled in first else if
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems we don't need this redirect?
If no, why don't add OData.Edm, and OData.Core redirect?
@@ -15,9 +15,9 @@ | |||
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net461" /> | |||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net461" /> | |||
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net461" developmentDependency="true" /> | |||
<package id="Microsoft.OData.Core" version="7.9.0" targetFramework="net461" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to update the dependency version #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a bug which is fixed in 7.9.1 with out which async would throw error in some scenarios
} | ||
|
||
/// <summary> | ||
/// Represents king of <see cref="DataModificationOperationKind"/> type of operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <summary> | ||
/// Represents response code | ||
/// </summary> | ||
public Int16 ResponseCode { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was taken crom vocabs and its like that so used same.
List<PathItem> pathItems = new List<PathItem>(); | ||
PathItem currentPathItem = null; | ||
|
||
foreach (ODataPathSegment segment in _pathSegments) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added check in constructor and in calling method
/// <summary> | ||
/// Constructor which takes and odataId and creates PathItems | ||
/// </summary> | ||
public NavigationPath() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected a single constructor that took the navigationPathName and parsed it into pathSegments in order construct the PathItem[]. If the navigationPathName could not be parsed it would return null for GetNavigationPathItems, and the consuming logic would have to fall back to the navigationPathName. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pathitems is already parsed in the deserializer by calling pathhandler.parse (for odata bind its already written by elizabeth) so wanteed to reuse it and not call it again , thats why used both in constructor
Removed default constructor
{ | ||
private string navigationPathName; | ||
private ReadOnlyCollection<ODataPathSegment> _pathSegments; | ||
private ConcurrentDictionary<string, PathItem[]> _pathItemCache = new ConcurrentDictionary<string, PathItem[]>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was introduced to handle multiple set of path items in the same path like customers(1)/Orders(1)/shipment(1) and customers(1)/Orders(1)/Address(1). so cache customes(1)/orders(1) not to call again . But since we are making seperate navigation paths for each object it wouldnt be ideal to keep a cache. Might be in later versions we can consider a centralizzed caching if we see such scenarios, even then we should think of heavy cache allocations . So removing it for now
{ | ||
private string navigationPathName; | ||
private ReadOnlyCollection<ODataPathSegment> _pathSegments; | ||
private ConcurrentDictionary<string, PathItem[]> _pathItemCache = new ConcurrentDictionary<string, PathItem[]>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was introduced to handle multiple set of path items in the same path like customers(1)/Orders(1)/shipment(1) and customers(1)/Orders(1)/Address(1). so cache customes(1)/orders(1) not to call again . But since we are making seperate navigation paths for each object it wouldnt be ideal to keep a cache. Might be in later versions we can consider a centralizzed caching if we see such scenarios, even then we should think of heavy cache allocations . So removing it for now
50cdd4c
to
3414464
Compare
* Bulk operations6 (#2) * BulkInsert1 draft * Bulk insert changes * deleted old test * updates * Update ODataResourceSetWrapper.cs * updates * Updated addressing comments * updates * updates updates * Updates * Updates * Minor updates * comments * updates * update publicapi for core * Address comments * Cleanup and additional tests Cleanup and additional tests * Updated code * BulkInsert1 draft * Bulk insert changes * deleted old test * updates * updates * Updated addressing comments * updates * updates updates * Updates * Updates * Minor updates * updates * Address comments * Cleanup and additional tests Cleanup and additional tests * DataAnnotationException updates * comments * small updates * updates * small update * updates * Updates * Update DeltaSetOfT.cs * Updates with Patch * updates * updates * Update WebHostTestFixture.cs * updates * Update DeltaOfTStructuralType.cs * Updates * Updates for serializer etc * Update WebHostTestFixture.cs * updates * updates * updates * Bulk Operations Updates * Review comments addressed * Updates * updated for deltaentity * Update Microsoft.AspNet.OData.Test.csproj * Update Microsoft.AspNet.OData.PublicApi.bsl * update public api * test fix * Update EdmStructuredObject.cs * Update EdmStructuredObject.cs * Update BulkInsertTest.cs * update * public api * review comments * Review comments updates * smalll update * updates * updates * updates
* support for odata.bind * support for odata.bind
* Bulk operations6 (#2) * BulkInsert1 draft * Bulk insert changes * deleted old test * updates * Update ODataResourceSetWrapper.cs * updates * Updated addressing comments * updates * updates updates * Updates * Updates * Minor updates * comments * updates * update publicapi for core * Address comments * Cleanup and additional tests Cleanup and additional tests * Updated code * BulkInsert1 draft * Bulk insert changes * deleted old test * updates * updates * Updated addressing comments * updates * updates updates * Updates * Updates * Minor updates * updates * Address comments * Cleanup and additional tests Cleanup and additional tests * DataAnnotationException updates * comments * small updates * updates * small update * updates * Updates * Update DeltaSetOfT.cs * Updates with Patch * updates * updates * Update WebHostTestFixture.cs * updates * Update DeltaOfTStructuralType.cs * Updates * Updates for serializer etc * Update WebHostTestFixture.cs * updates * updates * updates * Bulk Operations Updates * Review comments addressed * Updates * updated for deltaentity * Update Microsoft.AspNet.OData.Test.csproj * Update Microsoft.AspNet.OData.PublicApi.bsl * update public api * test fix * Update EdmStructuredObject.cs * Update EdmStructuredObject.cs * Update BulkInsertTest.cs * update * public api * review comments * Review comments updates * smalll update * updates * updates * updates
* support for odata.bind * support for odata.bind
Squashing Commits Update DeltaOfTStructuralType.cs test change Update Microsoft.AspNetCore.OData.Test.csproj Update Microsoft.Test.E2E.AspNetCore3x.OData.csproj updates Update WebStack.versions.settings.targets Update WebStack.versions.settings.targets Update GetNugetPackageMetadata.proj Update WebStack.versions.settings.targets For testing update Update BulkInsertController.cs Updates updates updates Update NuGet.Config Update BulkOperationPatchHandlersEF.cs updates
3414464
to
c42f50f
Compare
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) |
Issues
Used instead of PR #2524
PR For Bulk Operation and ODataBind Review for Beta Release
Description
PR For Bulk Operation and ODataBind Review for Beta Release
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.