protected static FindByPrimaryKey ( |
||
targetType | The AR subclass type | |
id | object | ID value |
리턴 | object |
public static T TryFind(object id) { return((T)ActiveRecordBase.FindByPrimaryKey(typeof(T), id, false)); }
/// <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)); }