Home » .Net FrameworkRSS

Error 11009: Property is not mapped

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?

 

2 Answers Found

 

Answer 1

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

 

 

 

Answer 2

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.

 

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter