You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use of ODataUriParser for a Uri containing a key-segment following a composable function returning a collection of entities:
Throws if the default key-parens syntax is used.
Works properly if the key-as-segment syntax is used.
Assemblies affected
All up to 7.18.0.
Reproduce steps
// Initializes a basic model.varmodel=new EdmModel();// Entity type 'user', with a single string property: its key 'id'.varuser= model.AddEntityType("graph","user", baseType:null, isAbstract:false, isOpen:false, hasStream:false);varkeyProperty= user.AddStructuralProperty("id", EdmPrimitiveTypeKind.String, isNullable:false);
user.AddKeys(keyProperty);// Entity container, with entity set 'users'.varcontainer= model.AddEntityContainer("graph","service");
container.AddEntitySet("users", user);// Function 'getConnections' bound to a 'user', with an int parameter and returning a collection of 'user'.varuserReference=new EdmEntityTypeReference(user, isNullable:false);varuserCollectionReference=new EdmCollectionTypeReference(new EdmCollectionType(userReference));vargetConnections=new EdmFunction("graph","getConnections", userCollectionReference, isBound:true, entitySetPathExpression:null, isComposable:true);
getConnections.AddParameter("boundParameter", userReference);
getConnections.AddParameter("degree", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Int16, isNullable:false));
model.AddElement(getConnections);// Simple URI: accesses an entity from the collection returned by the function 'getConnections'.// Works: KeySegment after OperationSegment uses key-as-segment syntax.varparser=new ODataUriParser(model,new System.Uri("/users('doe')/graph.getConnections(degree=1)/fawn", System.UriKind.Relative));varpath= parser.ParsePath();
Assert.IsNotNull(path);
Assert.AreEqual(4, path.Count);// EntitySetSegment, KeySegment, OperationSegment, KeySegment.// Throws: KeySegment after OperationSegment uses default key-parens syntax.parser=new ODataUriParser(model,new System.Uri("/users('doe')/graph.getConnections(degree=1)('fawn')", System.UriKind.Relative));try{path= parser.ParsePath();
Assert.Fail("Never reached, as ParsePath throws.");}catch(ODataExceptione){
Assert.AreEqual("Syntax error at position 9 in 'degree=1)('fawn''.", e.Message);}
Expected result
A valid ODataPath is returned when the key-parens syntax is used (identical to the one returned when the key-as-segment syntax is used).
Actual result
An ODataException is thrown.
The text was updated successfully, but these errors were encountered:
Use of ODataUriParser for a Uri containing a key-segment following a composable function returning a collection of entities:
Assemblies affected
All up to 7.18.0.
Reproduce steps
Expected result
A valid ODataPath is returned when the key-parens syntax is used (identical to the one returned when the key-as-segment syntax is used).
Actual result
An ODataException is thrown.
The text was updated successfully, but these errors were encountered: