Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: Segment parser not able to find entityset of a bound action when the action defines a return type like primitve. [595]

$
0
0
I used the ODataPathParserTests for this scenario.

Scenario: An action is bound to an entity type. It returns a simple type.

Expected: segment's EntitySet should be 'Customers'
Actual: segment's EntitySet is null

Definition (NOTE: the commented line below was on purpose so that i can return a primitive type):
------------
builder.Entity<Customer>().ComplexProperty<Address>(c => c.Address);
//builder.Entity<Customer>().Action("GetRelatedCustomers").ReturnsCollectionFromEntitySet<Customer>("Customers");
builder.Entity<Customer>().Action("GetRelatedCustomers").Returns<int>();

Test:
------
[Fact]
public void CanParseActionBoundToEntitySegment()
{
// Arrange
string testUrl = "http://myservice/Customers(112)/GetRelatedCustomers";
string expectedText = "GetRelatedCustomers";
IEdmFunctionImport expectedEdmElement = GetModel().EntityContainers().First().FunctionImports().SingleOrDefault(p => p.Name == "GetRelatedCustomers");
IEdmEntitySet expectedSet = GetModel().EntityContainers().First().EntitySets().SingleOrDefault(e => e.Name == "Customers");
IEdmType expectedType = expectedEdmElement.ReturnType.Definition;
Uri uri = new Uri(testUrl);
Uri baseUri = new Uri("http://myservice/");

// Act
ODataPathSegment segment = GetParser().Parse(uri, baseUri, GetModel());

.....

Viewing all articles
Browse latest Browse all 7215

Trending Articles