私は次の方法を持っています:-
public ActionResult CustomersDetails(string[] SelectRight)
{
var selectedCustomers = new SelectedCustomers
{
Info = SelectRight.Select(GetAccount)
};
return View(selectedCustomers);
}
private AccountDefinition GetAccount(string id)
{
return entities.AccountDefinition.Find(id);
}
しかし、それは次のエラーを返しています:-
The type of one of the primary key values did not match the type defined in the entity. See inner exception for details.
return entities.AccountDefinition.Find(id);
ライン上
では、このエラーの原因は何ですか?
内部の例外は次のとおりです。-
System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=The type of one of the primary key values did not match the type defined in the entity. See inner exception for details.
Parameter name: keyValues
Source=EntityFramework
ParamName=keyValues
StackTrace:
at System.Data.Entity.Internal.Linq.InternalSet`1.FindInStore(WrappedEntityKey key, String keyValuesParamName)
at System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues)
at System.Data.Entity.DbSet`1.Find(Object[] keyValues)
InnerException: System.Data.EntitySqlException
HResult=-2146232006
Message=The argument types 'Edm.Int64' and 'Edm.String' are incompatible for this operation. Near WHERE predicate, line 1, column 90.
Source=System.Data.Entity
Column=90
ErrorContext=WHERE predicate, line 1, column 90
ErrorDescription=The argument types 'Edm.Int64' and 'Edm.String' are incompatible for this operation.
Line=1