I'm new to Entity Framework 4.1, and I have pretty much the same problem as this guy: Adding A Custom Property To Entity Framework?
However, when I add a custom read-only property to my Entity using partial classes, I'm unable to access it as a property.
//Auto-generated Entity Class EntityModel.cs
public partial class Model
{
public string foo {get; set;}
public string bar {get; set;}
}
//Custom class EntityModelCustom.cs
public partial class Model
{
public string baz
{
get
{
return string.Format("{0}+{1}", this.foo, this.bar);
}
}
}
In my code, when I try to obtain property
Model m = new Model();
m.foo and m.bar are accessible. But I can't access m.baz which is what I want :-(
What am I doing wrong?