OData / lab

This repository is for exploring new ideas and developing early prototypes of various OData stacks.
Other
48 stars 59 forks source link

Scaffolding Support on Composite Keys #49

Open iqmeta opened 7 years ago

iqmeta commented 7 years ago

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.