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

Scaffolding Support on Composite Keys #49

Open
iqmeta opened this issue Nov 2, 2016 · 0 comments
Open

Scaffolding Support on Composite Keys #49

iqmeta opened this issue Nov 2, 2016 · 0 comments

Comments

@iqmeta
Copy link

iqmeta commented Nov 2, 2016

Hi,
is there a simple way to have, from Code First Model like:

public class Person
    {
        [Key]
        public string FirstName { get; set; }
        [Key]
        public string LastName { get; set; }

        public int Age { get; set; }
    }

the scaffolded Controllers like in your Sample?:

[EnableQuery]
     public Person Get([FromODataUri] string firstName, [FromODataUri] string lastName)
     {
         Person person = _repo.Get(firstName, lastName);
         if (person == null)
         {
             throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
         }

         return person;
     }

Easy on small amount of entities... but large models... uhhh.

https://github.com/OData/ODataSamples/tree/master/WebApi/v4/ODataCompositeKeySample

Kind regards.

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

No branches or pull requests

2 participants