I am new to LLBLGen pro and want to know the best way to check and see if a specific record (using PK) exists.
My table is called "users" and say i want to check ad see if user with loginID = "bob" is in the users table:
I am using 2 class method and have created the following static function in my entity class:
public static bool Exists(String sLoginID)
{
UsersCollection users = new UsersCollection();
IPredicateExpression selectFilter = new PredicateExpression(
PredicateFactory.CompareValue(UsersFieldIndex.LoginID,
ComparisonOperator.Equal, sLoginID));
users.GetMulti(selectFilter);
if (users.Count > 0) //the user is in the DB
{
return true;
}
else
{
return false;
}
}
The above works, but i dont want to have to write a function like this for all entity classes. I am sure LLBLGen must already do this without me writing a function, if so how?
thanks in advance