Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:35:44+00:00 2026-06-13T22:35:44+00:00

My project is created based on ASP.Net MVC Web API 4 application. If it’s

  • 0

My project is created based on ASP.Net MVC Web API 4 application. If it’s model have the following implementations :

public class BaseEntity
{
    public  object Id {get; set;}
}

public class Entity1 : BaseEntity
{
    public  string Name {get; set;}
}

And Wep API controller is :

public class Entity1Controller : ApiController
{
    ...

    [Queryable]
    public IQueryable<T> Get()
    {
        return repository.Table.AsQueryable();
    }
}

And Web API configuration have this setting :

public class WebApiApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        ...

        ODataModelBuilder modelBuilder = new ODataConventionModelBuilder();
        modelBuilder.EntitySet<BaseEntity>("BaseEntity");
        modelBuilder.EntitySet<Entity1>("Entity1");
        IEdmModel model = modelBuilder.GetEdmModel();

        GlobalConfiguration.Configuration.SetEdmModel(model);
    }
}

so, when one request is generated in the client side application :

$.getJSON("api/Entity1?$filter=Id eq '" + id + "'",
function (data) {
        ...
    });

my application encounter with the following error :

{"Message":"The query specified in the URI is not valid.","ExceptionMessage":"Type 'Entity 1' does not have a property 'Id'."}

Why the query specified in the URI is not valid using Web API OData ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:35:45+00:00Added an answer on June 13, 2026 at 10:35 pm

    Adding Inheritance Support to OdataModelBuilder

    Users can now define abstract entity types and entity types that derive from another entity type. OData doesn’t support complex type inheritance.

    This commit only adds support in the ModelBuilder. Support for inheritance in the ODataConventionModelBuilder, ODataMediaTypeFormatter and Query support is still pending.

    Reference : http://aspnetwebstack.codeplex.com/SourceControl/changeset/f4c252a30e68

    To solving above problem, use the following steps:

    1. Install nuget package from http://www.nuget.org/packages/Microsoft.AspNet.WebApi.OData
    2. Change type of Id property to string(It’s because object type is not a supported type in OData. You should make your Id as
      odata primitive types like string).
    3. Remove any configuration from Application_Start.
    4. Add config.EnableQuerySupport() to WebApi.config.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a new ASP.net MVC Web Application project. Inside my application, I created
I have a ASP.NET MVC 2 project. I've created edmx file on the class
I'm currently writing a project in ASP.NET MVC. I have a web project and
I created a web application using ASP.Net MVC 3 and EF 4.1, and I
I have a simple asp.net MVC4 / EF 4.1 project created with VS 2011,
I'm developing a plugin based application using MEF and Asp.NET MVC 3 and I
I created one asp.net mvc application using linq to sql, and in the generated
As a base for discussion. Create a standard ASP.NET MVC Web project. It will
I have an asp.net mvc application, which uses the default user database. It all
I have an asp.net-mvc website and people manage a list of projects. Based on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.