none
Error 11009: Property is not mapped

    Question

  • Greetings! Please keep in mind; I'm just beginning to learn and program the Entity Framework in .NET 4.

    In my Entity Model, I have added a custom property on a table which does not have a corresponding database column.

    I intend to use this custom property to contain a concatinated string returned from a stored procedure. I have imported the stored procedure using the "Add Function Import" wizard and designated the return collection as a set of Entities derived from my table. Everything looks good here, but the field on the table is throwing the error: Error 11009: Property 'FullName' is not mapped.

    I understand the property is not mapped because there is nothing in the database that represents a FullName. Can anyone help me to understand and resolve this problem?

    Wednesday, January 05, 2011 4:00 PM

Answers

  • Hello,

    My understanding is that you are trying to add the new property to the entity in the designer (for example by right-clicking on the entity, and choosing add -> scalar property). Using this approach will not work for what you are trying to achieve, since any properties added this way MUST be mapped to a table column. 

    Fortunately, there is another way you can add a property to an entity. It involves defining a partial class for the entity and adding the property or function to that partial class. I found a couple of blog entries that show how to do it:

    http://www.allpaul.com/blogs/programming/archive/2008/07/03/adding-computed-properties-to-entity-framework-entities.aspx

    http://dotnet.sys-con.com/node/527501

     

     

    Wednesday, January 05, 2011 9:37 PM
  • Hi,

     right click on EDMX design view there is an option "Generate Database from Model" . select "Generate Database from Model" it will generate a sql script . Copy generated script and paste in your sql query window and run. Now it will work fine.

     


    Thanks, Mukesh | [Remember to click mark as answered when you get a correct reply to your question]
    Thursday, January 06, 2011 4:40 AM

All replies

  • Hello,

    My understanding is that you are trying to add the new property to the entity in the designer (for example by right-clicking on the entity, and choosing add -> scalar property). Using this approach will not work for what you are trying to achieve, since any properties added this way MUST be mapped to a table column. 

    Fortunately, there is another way you can add a property to an entity. It involves defining a partial class for the entity and adding the property or function to that partial class. I found a couple of blog entries that show how to do it:

    http://www.allpaul.com/blogs/programming/archive/2008/07/03/adding-computed-properties-to-entity-framework-entities.aspx

    http://dotnet.sys-con.com/node/527501

     

     

    Wednesday, January 05, 2011 9:37 PM
  • Hi,

     right click on EDMX design view there is an option "Generate Database from Model" . select "Generate Database from Model" it will generate a sql script . Copy generated script and paste in your sql query window and run. Now it will work fine.

     


    Thanks, Mukesh | [Remember to click mark as answered when you get a correct reply to your question]
    Thursday, January 06, 2011 4:40 AM
  • Hello,

            I have same error should be come I find the solution.

    Reason Why this error is occure ?

    Error 11009: Property name is not mapped .edmx 5935 model ?

    Answer

    1) Field not found in table Please check it.

    2) In case Upper Case /lower case problem Check it.

    3) Check data Type in sql server 

    Then update entity.


    Thursday, October 11, 2012 6:55 AM
  • I got this Error too but it`s pretty easy to fix

    in my case i had an old property that i deleted in my sql file but in my model it was still there 

    You just have to klick on the Error in the Error List and delete the marked property by right click and delete after that you rebuild the solution and its fixed 

    Tuesday, June 14, 2016 9:41 AM