protected static Exists ( |
||
targetType | The target type. | |
id | object | The id to check on |
return | bool |
protected internal static bool Exists(Type targetType, object id)
{
EnsureInitialized(targetType);
ISession session = holder.CreateSession(targetType);
try
{
return session.Get(targetType, id) != null;
}
catch(Exception ex)
{
throw new ActiveRecordException("Could not perform Exists for " + targetType.Name + ". Id: " + id, ex);
}
finally
{
holder.ReleaseSession(session);
}
}
/// <summary> /// Check if any instance matches the query. /// </summary> /// <param name="targetType">target Type</param> /// <param name="detachedQuery">The query expression</param> /// <returns><c>true</c> if an instance is found; otherwise <c>false</c>.</returns> public static bool Exists(Type targetType, IDetachedQuery detachedQuery) { return(ActiveRecordBase.Exists(targetType, detachedQuery)); }