I have created an entity and it has a key of type Int. when I run the project and use this entity I get following error:
The ‘Id’ property on ‘Product’ could
not be set to a ‘Int64’ value. You
must set this property to a non-null
value of type ‘Int32’.
How can I fix it ?
Edit:
I am using SQL server and entity framework 4.1. I get error in controller action:
public ActionResult Test(long id)
{
return View(repository.GetObligor(id));
}
You mentioned that you defined entity with
intId but you are passinglongId. Try to convert it first tointor change Id in entity tolong.