The method is designed for retrieving an existing entity instance by specified criteria.
The method returns an entity instance of the specified class type selected by the specified LINQ query. The entity instance created by this method is initially attached to the data context and placed to the object cache (in contrast to the TCustomEntityContext.CreateEntity method), therefore you can already perform modification operations for the instance: TCustomEntityContext.Delete, TCustomEntityContext.Cancel) without pre-calling TCustomEntityContext.Attach. In addition, this entity instance will be automatically destroyed, and there will be no need to provide for its manual destruction.
Examples of calling the method:
var EmpType: IMetaType; Expression: ILinqQueryable; EmpEntity: TEmp; begin EmpType := Context['Emp']; Expression := Context.From(EmpType).Where(EmpType['EmpNo'] = 1).Select; EmpEntity := Context.GetEntity<TEmp>(Expression); // ... end;