I have a below class which represents my MySql Database table with Primary key column as 'PEOPLEID'
[Map("[PEOPLE]")]
public class CreatePeopleRecordModel
{
[Map("PEOPLEID")]
[Primary]
public Guid PeopleId { get; set; }
[Map("FIRSTNAME")]
public string FirstName { get; set; }
[Map("LASTNAME")]
public string LastName { get; set; }
}
When I call below code,
connection.Update(tableName, model);
"The primary field is not found."
I debugged the code and found that in below class getting the exception -
RepoDb.Core\RepoDb\Operations\DbConnection\Update.cs
// Variables needed
var primary = DbFieldCache.Get(connection, tableName, transaction)?.FirstOrDefault(dbField => dbField.IsPrimary);
var where = (QueryGroup)null;
// Identity the property via primary
if (primary != null)
{
var property = entity?.GetType().GetProperty(primary.Name, BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
if (property != null)
{
where = new QueryGroup(new QueryField(new Field(property.Name, property.PropertyType), property.GetValue(entity)));
}
else
{
throw new PrimaryFieldNotFoundException("The primary field is not found.");
}
}
The Primary key variable is resolved only based on database table column which is 'PEOPLEID', but in my class I have 'PeopleId'. It is not checking for [Primary] attribute exist in the class.
Suggest me how to solve this issue?
Discussed via Gitter Chat. This seems to be working at SqlServer but not in MySql. There will be investigation on Author's side and the agreement is to deliver the fix (if there is) by the end of this week. Otherwise, the author will provide an alternative fix to @eMTeTeam .
From the users.

The issue is also existing in the RepoDb.Core. I found a casing problem and ignorance of [Primary] attribute.
This will be fixed on RepoDb.MySql > v1.0.0, and RepoDb > v1.10.1.
The alternative is to use the following method.
connection.Update(tableName, model, model.PeopleId);
or
connection.Update<CreatePeopleRecordModel>(model);
The fixes is now available via RepoDb.MySql v1.0.1-alpha1 and to all upcoming releases above this version.
Verified the fix with RepoDb.MySql v1.0.1-alpha1 and it works.
Thanks! Cheers.
This issue will be closed on the actual release of RepoDb.MySql (v1.0.1).
The official fix is now available via RepoDb.MySql (v1.0.1). Closing this ticket now.