Like I mentioned in this question, I wanted to rename some auto generated properties.
So I use the following partial class
public partial class Plan
{
public Profile Creator
{
get { return this.Profile; }
set
{
this.Profile = value;
}
}
public Profile Guest
{
get { return this.Profile1; }
set
{
this.Profile1 = value;
}
}
}
to avoid using Profile1
and Profile
. It works but I can't use these new properties in a where clause because they are not mapped (well that's my guess).
Example:
myQuery.Where(x => x.Creator.User.UserName == userName)
I have the following exception
The specified type member 'Creator' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
I tried to map the property like this but without any success
[Column("creator_id", TypeName="int")]
public Profile Creator
{
get { return this.Profile; }
set
{
this.Profile = value;
}
}
Is it possible?