Repository navigation
Conversation
|
@xuzhg could you add test cases for this feature? And maybe add a bit more details to the description explaining why it fixes the issue? #Resolved |
| return path.Path; | ||
| } | ||
|
|
||
| private static Microsoft.OData.UriParser.ODataPath GeneratePath(IEdmEntitySetBase entitySetBase) |
There was a problem hiding this comment.
Minor: Can move it to a Factory implementation. #WontFix
There was a problem hiding this comment.
This is only used in this class once. So, it's better to keep it private in this helper class.
In reply to: 384850926 [](ancestors = 384850926)
|
|
||
| var tasks = new ProjectTask[] | ||
| { | ||
| new ProjectTask { Id = "1", ProjectId = "11", |
There was a problem hiding this comment.
Maybe indent the elements of the array.
| { | ||
| new ProjectTaskAssignment { Id = "22", ProjectTaskId = "2" } | ||
| } | ||
| }, |
There was a problem hiding this comment.
shouldn't this use the projectTasks passed in the payload?
|
+1 -- please add a test case. Should also support contained entity sets, although we could open a separate work item for that. In reply to: 589150185 [](ancestors = 589150185) |
| return new Microsoft.OData.UriParser.ODataPath(new SingletonSegment((IEdmSingleton)entitySetBase)); | ||
|
|
||
| case EdmNavigationSourceKind.ContainedEntitySet: | ||
| // TODO: for containment, do we have the scenario to return a containment in an operation? |
There was a problem hiding this comment.
Yes; this should be supported. This may seem like an edge case, but for services like Microsoft Graph that organize different sources of data through a singleton navigation property it is actually the common scenario. #Closed
There was a problem hiding this comment.
I add codes to process this case. Please take a look
In reply to: 385351278 [](ancestors = 385351278)
|
Added E2E test cases. Please take a look. In reply to: 592155477 [](ancestors = 592155477,589150185) |
|
|
||
| case EdmNavigationSourceKind.ContainedEntitySet: | ||
| IEdmContainedEntitySet containedEntitySet = (IEdmContainedEntitySet)navigationSource; | ||
| var path = GeneratePath(containedEntitySet.ParentNavigationSource); |
There was a problem hiding this comment.
var [](start = 20, length = 3)
var [](start = 20, length = 3)
better not to use var #Closed
There was a problem hiding this comment.
Yes. I know. I originally thought it's easy to use "var" not "Microsoft.OData.UriParser.ODataPath". But I changed.
In reply to: 386706993 [](ancestors = 386706993)
| } | ||
| } | ||
|
|
||
| segments.Add(new NavigationPropertySegment(containedEntitySet.NavigationProperty, containedEntitySet.ParentNavigationSource)); |
There was a problem hiding this comment.
is this the right behavior for path == null? if path==null, shouldn't you just return null?
There was a problem hiding this comment.
Emm... probably. in ODL, IEdmContainedEntitySet interface is public, but there's only one implementation "EdmContainedEntitySet" is internal. That means user can't create a "EdmContainedEntitySet" instance. If you can get an instance of "IEdmContainedEntitySet", the ParentNavigationSource should be valid. So, i'd like to remove the conditional verification.
In reply to: 386708095 [](ancestors = 386708095)
There was a problem hiding this comment.
This method looks similar to the ComputePath() method in EdmContainedEntitySet, which is unfortunately internal. However, that method deals with nav props defined on derived types. Do we need to do anything to handle that case here?
Also a bit concerned that EdmContainedEntitySet allows passing in a navigationPath, which is used in ComputePath. What are the situations in which that would be something other than the navigationProperty? Would this be used for nav props on complex types? Do we need to handle that case here?
In reply to: 386750791 [](ancestors = 386750791,386708095)
There was a problem hiding this comment.
EdmContainedEntitySet constructor makes the input check. That can make sure "ParentNavigationSource" never be null if the "EntityContainedEntitySet" is live.
public EdmContainedEntitySet(IEdmNavigationSource parentNavigationSource, IEdmNavigationProperty navigationProperty, IEdmPathExpression navigationPath)
: base(navigationProperty.Name, navigationProperty.ToEntityType())
{
EdmUtil.CheckArgumentNull(parentNavigationSource, "parentNavigationSource");
...
this.parentNavigationSource = parentNavigationSource;
this.navigationProperty = navigationProperty;
this.navigationPath = navigationPath;
}
In reply to: 391139997 [](ancestors = 391139997,386750791,386708095)
There was a problem hiding this comment.
Besides, for the ComputePath() method in EdmContainedEntitySet, we can call " containedEntitySet.Path" to get the Path. However, "Path" is IEdmPathExpression, it's a string segment.
We want the ODataPath, it's a path segments. So, we have to use "OData Uri parse" to parse the "IEdmPathExpression". That's not feasible here.
I'd like to create a new issue to track on this feature request. And I do think that's a feature in the ODL .
In reply to: 394725483 [](ancestors = 394725483,391139997,386750791,386708095)
There was a problem hiding this comment.
@[email protected] -- did you create an issue to track this? Please specifically call out what is not currently supported (i.e., how does this code handle navigation properties on complex types or navigation properties defined on derived types? does it work with navigation properties on entities returned from contained navigation properties?)
In reply to: 394726333 [](ancestors = 394726333,394725483,391139997,386750791,386708095)
|
|
||
| private static Microsoft.OData.UriParser.ODataPath GeneratePath(IEdmNavigationSource navigationSource) | ||
| { | ||
| switch (navigationSource.NavigationSourceKind()) |
There was a problem hiding this comment.
Maybe add assert that navigationSource != null #Closed
| return null; | ||
| } | ||
|
|
||
| if (IsOperationPath(path)) |
There was a problem hiding this comment.
What is the value in doing this check? It's going to walk the path looking for an operationSegment or operationImportSegment, and if it returns true, we're going to go to the last segment and check to see if it's an operationSegment or operationImportSegment. Can we remove the IsOperationPath(path) check and just rely on the existing checks on line 363 and 369? The only difference I can see in doing the check first is that the current logic will return a null if there is an operation (i.e., a composible function) in the path but not as the last segment -- is that desired behavior? #Resolved
There was a problem hiding this comment.
I'd like to keep the behavior unchanged. if we consider the compossible function, the logic here is not enough to cover it.
In reply to: 401841900 [](ancestors = 401841900)
| public async Task BoundFunctionWithContainmentReturnTypeWorksWithCorrectContextUri() | ||
| { | ||
| // Arrange | ||
| var requestUri = string.Format("{0}/odata/Projects/Default.GetAssigments", BaseAddress); |
There was a problem hiding this comment.
how about adding a segment after the bound function call, i.e.:
-Projects/Default.GetAssignments/111
-Projects/Default.GetAssignments/Default.ProjectTaskAssignment
| public async Task BoundFunctionWithNonContainmentReturnTypeWorksWithCorrectContextUri() | ||
| { | ||
| // Arrange | ||
| var requestUri = string.Format("{0}/odata/Projects/Default.GetProjectTask", BaseAddress); |
There was a problem hiding this comment.
var requestUri = string.Format("{0}/odata/Projects/Default.GetProjectTask" [](start = 0, length = 86)
how about adding a segment after the bound function call, i.e.:
-Projects/Default.GetProjectTask/1
-Projects/Default.GetDefaultProjectTask/Default.ProjectTask
|
Still have a couple of small comments, but nothing to block merging. |
|
Merged at c79634a |
…eton
Issues
This pull request fixes issue ##2056.
Description
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.