Performs a projected selection from an entity, lifting only the required fields. Similar to SELECT Id,Name FROM MyTable instead of selecting everything. It is possible to combine this with grouping.

Namespace: Castle.ActiveRecord.Queries
Assembly:  Castle.ActiveRecord (in Castle.ActiveRecord.dll)
Version: 1.0.3.0

Syntax

C#
public class ProjectionQuery<ARType, TResultItem> : IActiveRecordQuery

Type Parameters

ARType
The active record entity type
TResultItem
The result value to use: object[] means returning as is

Examples

CopyC#
ProjectionQuery<Post, PostTitleAndId> proj = new ProjectionQuery<Post, PostTitleAndId>(Projections.Property("Title"), Projections.Property("Id"));
ICollection<PostTitleAndId> posts = proj.Execute();
foreach(PostTitleAndId titleAndId in posts)
{
    //push to site...
}

Inheritance Hierarchy

System..::Object
  Castle.ActiveRecord.Queries..::ProjectionQuery<(Of <ARType, TResultItem>)>
    Castle.ActiveRecord.Queries..::ProjectionQuery<(Of <ARType>)>

See Also