Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update Database.cs (#442)
Parameter support entity objects
  • Loading branch information
mayb authored and pleb committed May 1, 2018
1 parent 22666f8 commit a6b0e9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PetaPoco/Database.cs
Expand Up @@ -1047,7 +1047,8 @@ public bool Exists<T>(string sqlCondition, params object[] args)
/// <returns>True if a record with the specified primary key value exists.</returns>
public bool Exists<T>(object primaryKey)
{
return Exists<T>(string.Format("{0}=@0", _provider.EscapeSqlIdentifier(PocoData.ForType(typeof(T), _defaultMapper).TableInfo.PrimaryKey)), primaryKey);
var poco = PocoData.ForType(typeof(T), _defaultMapper);
return Exists<T>(string.Format("{0}=@0", _provider.EscapeSqlIdentifier(poco.TableInfo.PrimaryKey)), primaryKey is T ? poco.Columns[poco.TableInfo.PrimaryKey].GetValue(primaryKey) : primaryKey);
}

#endregion
Expand Down

0 comments on commit a6b0e9f

Please sign in to comment.