Inside of my model I have an attribute called attributes that its value is taken from the cutomized_attributes in my Database the property attributes does Not exist in the Database its just calculated value, while I’m trying to do the following I’m facing this error:
Error: System.Data.Entity.Edm.EdmEntityType: : EntityType ‘JToken’ has no key defined. Define the key for this EntityType
Model:
public class Restaurant
{
public int id{ get; set; }
public string name{ get; set; }
public string cutomized_attributes { get; set; }
private JObject _attributes { get; set; }
public JObject attributes
{
get
{
if (this._attributes == null)
return this._attributes = RestaurantAttributes.parseAttrString(this.cutomized_attributes);
return this._attributes;
}
set
{
this._attributes = value;
}
}
}
assuming you are using code first… within the dbcontext subclass