Permalink
Browse files

Update Database.cs (#442)

Parameter support entity objects
  • Loading branch information...
maybgit authored and pleb committed May 1, 2018
1 parent 22666f8 commit a6b0e9fd6ddd30999544135650c016d78cd92ee2
Showing with 2 additions and 1 deletion.
  1. +2 −1 PetaPoco/Database.cs
@@ -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

0 comments on commit a6b0e9f

Please sign in to comment.