views:

438

answers:

2

Hi there,

I wanted to add a new property to one of my model (table). Basically its a property that doesn't exist in the database but i need to add it to my model so that the custom generation tool (self tracking entity generator) will create the the property inside the the custom generated file.

I added a scaler property, its a string and called testme but it gives me the following error, Anybody know how i can fix this?

Error 2538 Error 11009: Property 'testme' is not mapped.

I am confused why do i need to map it to a table... its a field that doesn't exist in the table ...

Any help really appreciated

Thanks

A: 

Generally, you add un-mapped properties to a partial class instead of via the model. That said, use discretion; un-mapped properties can be confusing, since they mostly can't be used in LINQ to Entities queries.

Craig Stuntz
Hi Craig, thanks for the reply... So are you saying i should add them into a new file using the partial class by hand?? I presume i need to decorate the properties added manual with [DataMember] and called OnPropertyChanged like the auto generated file does??
mark smith
Respectively, yes, code non-mapped properties by hand and no, `DataMember` is only for mapped properties. `OnPropertyChanged` is for your convenience only, so add it if you want; it's not important ot the EF.
Craig Stuntz
A: 

I know this doesn't address your problem, but Googling for this error returns this question. Hopefully this answer will be useful to others who are new to EF and hit this message, like I did.

I've been generating my DB from my conceptual model. If I modify the model without updating the DB, then I see this error message.

At the moment I don't have any data in my model, so simply regenerating the DB from the changed model makes these errors go away.

Drew Noakes