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

Adding support for AlternateKeyODataUriResolver #419

Closed
wants to merge 7 commits into from

Conversation

Projects
None yet
5 participants
@abkmr
Copy link
Contributor

commented Jun 25, 2015

Adding support for AlternateKeyODataUriResolver
Corresponding updates in ODataUriResolverSetttings.

abkmr added some commits May 27, 2015

Adding support for AlternateKeyODataUriResolver
Adding support for AlternateKeyODataUriResolver, and updating
ODataUriResolverSettings.
@msftclas

This comment has been minimized.

Copy link

commented Jun 25, 2015

Hi @abkmr, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@congysu congysu added this to the v5.7 milestone Jun 27, 2015

@xuzhg

This comment has been minimized.

Copy link
Member

commented Jul 2, 2015

@abkmr The product codes look good to me. However, would you please add UT, FT, and E2E? Thanks

@xuzhg

This comment has been minimized.

Copy link
Member

commented Jul 9, 2015

@abkmr How to set the alternate key by annotation on CLR models?

Adding unit tests for the HttpConfiguration and ResolverSettings changes
Adding unit tests for the HttpConfiguration and ResolverSettings changes
@@ -228,6 +228,20 @@ public void EnableEnumPrefixFree_Sets_EnumPrefixFreeFlag()
Assert.True(resolverSetttings.EnumPrefixFree);
}

[Fact]
public void EnableAlternateKeys_Sets_EnumPrefixFreeFlag()

This comment has been minimized.

Copy link
@xuzhg

xuzhg Jul 24, 2015

Member

change the test case name

This comment has been minimized.

Copy link
@abkmr

abkmr Jul 24, 2015

Author Contributor

changed and updated PR.

@xuzhg

This comment has been minimized.

Copy link
Member

commented Jul 24, 2015

@abkmr Need E2E test cases and one simple page to introduce the alternate key usage.

see: http://odata.github.io/WebApi/#04-14-capabilities-vocabulary-support

abkmr added some commits Jul 24, 2015

Updating HttpConfigurationTestCase
Updating HttpConfigurationTestCase
Adding E2e tests for Alternate Keys
Adding E2e tests for Alternate Keys
@abkmr

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2015

Added E2E test case. Will add the document as mentioned.

Thanks
Abhishek

On Thu, Jul 23, 2015 at 10:21 PM -0700, "Sam Xu" <notifications@github.commailto:notifications@github.com> wrote:

@abkmrhttps://github.com/abkmr Need E2E test cases and one simple page to introduce the alternate key usage.

see: http://odata.github.io/WebApi/#04-14-capabilities-vocabulary-support

Reply to this email directly or view it on GitHubhttps://github.com//pull/419#issuecomment-124334893.

webConfig.AddRAMFAR(true);
}

public static TheoryDataSet<string, string, string> CaseInsensitiveCases

This comment has been minimized.

Copy link
@xuzhg

xuzhg Jul 28, 2015

Member

why also named as "CaseInsensitiveCases"?

return new TheoryDataSet<string, string, string>()
{
// method, requestPath, response
{ "Get", "$metadata", "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<edmx:Edmx Version=\"4.0\" xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\">\r\n <edmx:DataServices>\r\n <Schema Namespace=\"WebStack.QA.Test.OData.UriParserExtension\" xmlns=\"http://docs.oasis-open.org/odata/ns/edm\">\r\n <EntityType Name=\"Customer\">\r\n <Key>\r\n <PropertyRef Name=\"Id\" />\r\n </Key>\r\n <Property Name=\"Id\" Type=\"Edm.Int32\" Nullable=\"false\" />\r\n <Property Name=\"Name\" Type=\"Edm.String\" />\r\n <Property Name=\"Gender\" Type=\"WebStack.QA.Test.OData.UriParserExtension.Gender\" Nullable=\"false\" />\r\n <NavigationProperty Name=\"Orders\" Type=\"Collection(WebStack.QA.Test.OData.UriParserExtension.Order)\" />\r\n <Annotation Term=\"OData.Community.Keys.V1.AlternateKeys\">\r\n <Collection>\r\n <Record Type=\"OData.Community.Keys.V1.AlternateKey\">\r\n <PropertyValue Property=\"Key\">\r\n <Collection>\r\n <Record Type=\"OData.Community.Keys.V1.PropertyRef\">\r\n <PropertyValue Property=\"Alias\" String=\"Name\" />\r\n <PropertyValue Property=\"Name\" PropertyPath=\"Name\" />\r\n </Record>\r\n </Collection>\r\n </PropertyValue>\r\n </Record>\r\n </Collection>\r\n </Annotation>\r\n </EntityType>\r\n <EntityType Name=\"Order\">\r\n <Key>\r\n <PropertyRef Name=\"Id\" />\r\n </Key>\r\n <Property Name=\"Id\" Type=\"Edm.Int32\" Nullable=\"false\" />\r\n <Property Name=\"Title\" Type=\"Edm.String\" />\r\n </EntityType>\r\n <EntityType Name=\"VipCustomer\" BaseType=\"WebStack.QA.Test.OData.UriParserExtension.Customer\">\r\n <Property Name=\"VipProperty\" Type=\"Edm.String\" />\r\n </EntityType>\r\n <EnumType Name=\"Gender\">\r\n <Member Name=\"Male\" Value=\"1\" />\r\n <Member Name=\"Female\" Value=\"2\" />\r\n </EnumType>\r\n </Schema>\r\n <Schema Namespace=\"Default\" xmlns=\"http://docs.oasis-open.org/odata/ns/edm\">\r\n <EntityContainer Name=\"Container\">\r\n <EntitySet Name=\"Customers\" EntityType=\"WebStack.QA.Test.OData.UriParserExtension.Customer\">\r\n <NavigationPropertyBinding Path=\"Orders\" Target=\"Orders\" />\r\n </EntitySet>\r\n <EntitySet Name=\"Orders\" EntityType=\"WebStack.QA.Test.OData.UriParserExtension.Order\" />\r\n </EntityContainer>\r\n </Schema>\r\n </edmx:DataServices>\r\n</edmx:Edmx>"},

This comment has been minimized.

Copy link
@xuzhg

xuzhg Jul 28, 2015

Member

You don't add cases to illustrate how to use alternate key?

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
string responseContent = await response.Content.ReadAsStringAsync();

Assert.Equal(responseContent, comparisonValue);

This comment has been minimized.

Copy link
@xuzhg

xuzhg Jul 28, 2015

Member

(Expect, Actual)

{
// method, requestPath, response
{ "Get", "$metadata", "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<edmx:Edmx Version=\"4.0\" xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\">\r\n <edmx:DataServices>\r\n <Schema Namespace=\"WebStack.QA.Test.OData.UriParserExtension\" xmlns=\"http://docs.oasis-open.org/odata/ns/edm\">\r\n <EntityType Name=\"Customer\">\r\n <Key>\r\n <PropertyRef Name=\"Id\" />\r\n </Key>\r\n <Property Name=\"Id\" Type=\"Edm.Int32\" Nullable=\"false\" />\r\n <Property Name=\"Name\" Type=\"Edm.String\" />\r\n <Property Name=\"Gender\" Type=\"WebStack.QA.Test.OData.UriParserExtension.Gender\" Nullable=\"false\" />\r\n <NavigationProperty Name=\"Orders\" Type=\"Collection(WebStack.QA.Test.OData.UriParserExtension.Order)\" />\r\n <Annotation Term=\"OData.Community.Keys.V1.AlternateKeys\">\r\n <Collection>\r\n <Record Type=\"OData.Community.Keys.V1.AlternateKey\">\r\n <PropertyValue Property=\"Key\">\r\n <Collection>\r\n <Record Type=\"OData.Community.Keys.V1.PropertyRef\">\r\n <PropertyValue Property=\"Alias\" String=\"Name\" />\r\n <PropertyValue Property=\"Name\" PropertyPath=\"Name\" />\r\n </Record>\r\n </Collection>\r\n </PropertyValue>\r\n </Record>\r\n </Collection>\r\n </Annotation>\r\n </EntityType>\r\n <EntityType Name=\"Order\">\r\n <Key>\r\n <PropertyRef Name=\"Id\" />\r\n </Key>\r\n <Property Name=\"Id\" Type=\"Edm.Int32\" Nullable=\"false\" />\r\n <Property Name=\"Title\" Type=\"Edm.String\" />\r\n </EntityType>\r\n <EntityType Name=\"VipCustomer\" BaseType=\"WebStack.QA.Test.OData.UriParserExtension.Customer\">\r\n <Property Name=\"VipProperty\" Type=\"Edm.String\" />\r\n </EntityType>\r\n <EnumType Name=\"Gender\">\r\n <Member Name=\"Male\" Value=\"1\" />\r\n <Member Name=\"Female\" Value=\"2\" />\r\n </EnumType>\r\n </Schema>\r\n <Schema Namespace=\"Default\" xmlns=\"http://docs.oasis-open.org/odata/ns/edm\">\r\n <EntityContainer Name=\"Container\">\r\n <EntitySet Name=\"Customers\" EntityType=\"WebStack.QA.Test.OData.UriParserExtension.Customer\">\r\n <NavigationPropertyBinding Path=\"Orders\" Target=\"Orders\" />\r\n </EntitySet>\r\n <EntitySet Name=\"Orders\" EntityType=\"WebStack.QA.Test.OData.UriParserExtension.Order\" />\r\n </EntityContainer>\r\n </Schema>\r\n </edmx:DataServices>\r\n</edmx:Edmx>"},
{ "Get", "Customers(1)/Name/$value", "Customer #1"}

This comment has been minimized.

Copy link
@xuzhg

xuzhg Jul 28, 2015

Member

Why test this?

@xuzhg

This comment has been minimized.

Copy link
Member

commented Aug 3, 2015

Merged the related E2E test cases. #451. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.