I have web api with OData controller. Models is
public class UserDto
{
public int UserDtoId {get;set;}
public string Name {get;set;}
}
in controller I have two method
[EnableQuery]
public IQueryable<UserDto> Get();
[EnableQuery]
public SingleResult<UserDto> GetUser([FromODataUri] int key);
OData config is:
ODataModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<UserDto>("Users").EntityType.HasKey(e=>e.UserDtoId).Name = "User";
config.MapODataServiceRoute(
routeName: "ODataRoute",
routePrefix: "odata",
model: builder.GetEdmModel());
when I try invoke odata/Users(123), the odata try to invoke first get not a get with a key and return me all record from table. When I comment out first get method there is none GET method for this URI access at all. Where I make a mistake?
I try to make [ODataRoute] its doesnt change nothing.