Поделиться через


EntitySet: Projects (ProjectData service)

In this article
Definition
Attributes
Parent element
Child elements

Specifies the collection of projects in the ReportingData schema.

Definition

<EntitySet Name="Projects" EntityType="ReportingData.Project" />

Attributes

Attribute

Value

Description

Name

Projects

The name of the entity set.

EntityType

ReportingData.Project

The type of entity.

Parent element

Element

Description

EntityContainer element: ReportingData

Contains definitions of entity sets for internal use in queries of the online Reporting database.

Child elements

None

Example

var query =
    from p in Projects
    where p.ProjectStartDate > new DateTime(2012, 1, 1)
    orderby p.ProjectName
    select new
    {
        Project = p.ProjectName,
        StartDate = p.ProjectStartDate,
        FinishDate = p.ProjectFinishDate,
        ProjectCost = p.ProjectCost
    };

The preceding statement can be written by using Lambda expression syntax, as follows:

var query = Projects
    .Where(p => (p.ProjectStartDate > (DateTime?)(new DateTime(2012, 1, 1))))
    .OrderBy(p => p.ProjectName)
    .Select(p => new
    {
        Project = p.ProjectName,
        StartDate = p.ProjectStartDate,
        FinishDate = p.ProjectFinishDate,
        ProjectCost = p.ProjectCost
    });

Either statement creates the following REST URL (all on one line).

https://ServerName/pwa/_vti_bin/client.svc/ProjectServerData/Projects()?
    $filter=ProjectStartDate gt datetime'2012-01-01T00:00:00'&
    $orderby=ProjectName&
    $select=ProjectName,ProjectStartDate,ProjectFinishDate,ProjectCost

All three of the sample queries get the same data.

Sample results of the Task query

Project

StartDate

FinishDate

ProjectCost

ProjectA

3/1/2012 8:00:00 AM

3/15/2012 5:00:00 PM

$1124.00

ProjectB

3/1/2012 8:00:00 AM

3/24/2012 5:00:00 PM

$2171.00

ProjectC

3/1/2012 8:00:00 AM

3/17/2012 5:00:00 PM

$1968.00

Remarks

Each entity set has a specific page-size limit. For information about page limits for on-premises and online ProjectData queries and how to set the on-premises page limit, see ProjectData - OData service reference.

See also

Reference

EntityType element: Project