NPersistence Reference Guide
Get an instance, whose state may be lazily fetched. If the requested instance does not exist in the database, the EntityNotFoundException is thrown when the instance state is first accessed. (The persistence provider runtime is permitted to throw the EntityNotFoundException when getReference is called.) The application should not expect that the instance state will be available upon detachment, unless it was accessed by the application while the entity manager was open.

Namespace: NPersistence
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)

Syntax

   
 C# 
T GetReference<T>(
	Type entityClass,
	Object primaryKey
)

Parameters

entityClass
Type
entity class
primaryKey
Object
primary key

Type Parameters

T

Return Value

the found entity instance

Exceptions

ExceptionCondition
System..::..ArgumentException if the first argument does not denote an entity type or the second argument is not a valid type for that entity’s primary key or is null
NPersistence..::..EntityNotFoundException if the entity state cannot be accessed

See Also