FindByPrimaryKey() protected static method

Finds an object instance by an unique ID
protected static FindByPrimaryKey ( Type targetType, object id ) : object
targetType System.Type The AR subclass type
id object ID value
return object
コード例 #1
0
 public static T TryFind(object id)
 {
     return((T)ActiveRecordBase.FindByPrimaryKey(typeof(T), id, false));
 }
コード例 #2
0
 /// <summary>
 /// Finds an object instance by its primary key.
 /// </summary>
 /// <param name="targetType">The AR subclass type</param>
 /// <param name="id">ID value</param>
 /// <param name="throwOnNotFound"><c>true</c> if you want an exception to be thrown
 /// if the object is not found</param>
 /// <exception cref="ObjectNotFoundException">if <c>throwOnNotFound</c> is set to
 /// <c>true</c> and the row is not found</exception>
 public static object FindByPrimaryKey(Type targetType, object id, bool throwOnNotFound)
 {
     return(ActiveRecordBase.FindByPrimaryKey(targetType, id, throwOnNotFound));
 }