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

PR For Bulk Operation and ODataBind Review for Beta Release #2524

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

Conversation

Sreejithpin
Copy link
Contributor

Issues

PR For Bulk Operation and ODataBind Review for Beta Release
This pull request fixes issue #xxx.

Description

Briefly describe the changes of this pull request.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

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.

Sreejithpin and others added 3 commits July 8, 2021 11:29
* 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
@@ -42,6 +42,13 @@ internal static string SelectActionImpl(ODataPath odataPath, IWebApiControllerCo
"Post" + entitySet.EntityType().Name,
"Post");
}
else if (ODataRequestMethod.Patch == controllerContext.Request.Method)
{
// e.g. Try PatchCustomer first, then fall back to Patch action name
Copy link
Member

@xuzhg xuzhg Jul 14, 2021

Choose a reason for hiding this comment

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

PatchCustomer

PatchCustomers #Resolved

@xuzhg
Copy link
Member

xuzhg commented Jul 14, 2021

                    "PostFrom" + entityType.Name);

do we support patch from cast?

PATCH ~/Customers/NS.VipCustomer


Refers to: src/Microsoft.AspNet.OData.Shared/Routing/Conventions/EntitySetRoutingConvention.cs:83 in fbe081a. [](commit_id = fbe081a, deletion_comment = False)

using Org.OData.Core.V1;
using System;
using System.Collections.Generic;
using System.Text;
Copy link
Member

@xuzhg xuzhg Jul 14, 2021

Choose a reason for hiding this comment

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

sort #Resolved

/// Helper class for OData Serialization
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors")]
public class ODataSerializerHelper
Copy link
Member

@xuzhg xuzhg Jul 14, 2021

Choose a reason for hiding this comment

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

ODataSerializerHelper

if it's an internal class (I noticed no public API in this class), why don't mark the class as interal, and mark API as public.

In current design, we have a public class, but nothing in the public class from customer perspetive. #Resolved

/// </summary>
[Obsolete("Please use ResourceBase instead")]
Copy link
Member

Choose a reason for hiding this comment

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

[Obsolete("Please use ResourceBase instead")]

This obsolete seems unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea was to make it obselete but not to remove, right @mikepizzo . but I guess in 8.0 its removed right?

Copy link
Member

Choose a reason for hiding this comment

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

In 8.0 the Resource property should be typed as ODataResourceBase.

@Sreejithpin
Copy link
Contributor Author

                    "PostFrom" + entityType.Name);

Normal Patch (Delta) supports inheritance/casting right?


In reply to: 880162857


Refers to: src/Microsoft.AspNet.OData.Shared/Routing/Conventions/EntitySetRoutingConvention.cs:83 in fbe081a. [](commit_id = fbe081a, deletion_comment = False)

/// <summary>
/// Handler Class to handle users methods for create, delete and update
/// </summary>
public abstract class EdmPatchMethodHandler
Copy link
Member

Choose a reason for hiding this comment

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

EdmPatchMethodHandler

Since this is not just used for Patch, should we consider renaming to something like "UpdateHandler" or "DataModificationHandler"?

/// </summary>
NotFound
}

Copy link
Member

@mikepizzo mikepizzo Jul 27, 2021

Choose a reason for hiding this comment

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

This should be in a separate file #Resolved

/// <summary>
/// Base Interface for PatchMethodHandler
/// </summary>
public interface IPatchMethodHandler
Copy link
Member

@mikepizzo mikepizzo Jul 27, 2021

Choose a reason for hiding this comment

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

IPatchMethodHandler

I'm sure I asked this before, but why do we need an empty marker interface? Can you add to the comments so that it's clear to others in the future?

Also, this should be in a separate file so that it is easy to find. #Resolved


namespace Microsoft.AspNet.OData
{
internal class DefaultPatchHandler<TStructuralType> : PatchMethodHandler<TStructuralType> where TStructuralType :class
Copy link
Member

@mikepizzo mikepizzo Jul 27, 2021

Choose a reason for hiding this comment

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

DefaultPatchHandler

Add comments describing this class, its behavior, and where/when it is appropriate to use. #Resolved

{

/// <summary>
/// Handler Class to handle users methods for create, delete and update
Copy link
Member

@mikepizzo mikepizzo Jul 27, 2021

Choose a reason for hiding this comment

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

Handler Class to handle users methods for create, delete and update

Add that this is for the case where there is no CLR type -- PatchMethodHandler is used when there is a clr type. #Resolved

}

/// <summary>
/// Handler Class to handle users methods for create, delete and update
Copy link
Member

@mikepizzo mikepizzo Jul 27, 2021

Choose a reason for hiding this comment

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

Handler Class to handle users methods for create, delete and update

add to the description that this is for the clr-backed objects; EdmPatchMethodHandler is used for the non-CLR backed case. #Resolved

namespace Microsoft.AspNet.OData
{
/// <summary>
/// Basic interface to reperesent a deltaset which is a collection of Deltas.
Copy link
Member

@mikepizzo mikepizzo Jul 27, 2021

Choose a reason for hiding this comment

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

Basic interface to reperesent a deltaset which is a collection of Deltas.

Please describe why we have this marker interface with no members. #Resolved

/// <returns>DeltaSet response</returns>
public DeltaSet<TStructuralType> Patch(IPatchMethodHandler patchHandler)
{
return CopyChangedValues(patchHandler as PatchMethodHandler<TStructuralType>);
Copy link
Member

@mikepizzo mikepizzo Jul 27, 2021

Choose a reason for hiding this comment

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

patchHandler as PatchMethodHandler

what happens if this cast fails? #Resolved

Sreejithpin and others added 5 commits July 27, 2021 07:26
* Add [EnableNestedPaths] attribute that transforms result query based on path

* Add NestedPathsRoutingConvention for .netcore

* Make it possible to access action descriptor from action map

* Fix bug in WebApiActionDescriptor.GetCustomAttributes()

* Add tests for NestedPathsRoutingConvention

* Add routing tests

* Add tests for ODataPathQueryBuilder

* Fix tests

* Fix build errors is AspNet

* Minor cleanup

* Fix build error

* Reuse existing ExpressionHelpers methods in ODataPathQueryBuilder

* Minor code cleanup based on review comments

* Remove var keyword

* Fix some failing tests

* Fix failing tests

* Better support single results when [EnableQuery] is set and better support for EF Core

* Add e2e tests

* Add EF e2e tests

* Refactoring

* Update core 3.x public API

* Minor refactors

* Fix build errors in aspnet

* Fix aspnet classic tests

* Update projitems

* Fix failing tests

* Refactoring

* Address PR comments and refactor

* Conditionally-compile code only supported in net core

* Minor clean up
Bumps System.Text.RegularExpressions from 4.3.0 to 4.3.1.

---
updated-dependencies:
- dependency-name: System.Text.RegularExpressions
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps System.Text.RegularExpressions from 4.3.0 to 4.3.1.

---
updated-dependencies:
- dependency-name: System.Text.RegularExpressions
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
dxrdxr and others added 28 commits August 25, 2021 11:12
* 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
@pull-request-quantifier-deprecated

This PR has 7513 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Extra Large
Size       : +6890 -623
Percentile : 100%

Total files changed: 1868

Change summary by file extension:
.md : +7 -3
.txt : +2 -1
.yml : +226 -0
.cs : +5975 -426
.csproj : +103 -43
.config : +118 -103
.resx : +18 -0
.projitems : +30 -0
.nuspec : +26 -18
.bsl : +381 -24
.proj : +0 -1
.targets : +4 -4

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detetcted.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants