Click to Rate and Give Feedback
MSDN
MSDN Library
Live Services SDK
Live Framework SDK
Resource Scripts
 Resource Script Program Grammar

  Switch on low bandwidth view
Resource Script Program Grammar
[This is preliminary documentation and is subject to change.]

Resource Script program grammar includes constructs for declaratively modeling control flow, data flow, create, read, update, and delete (CRUD), and FeedSync interactions. Applications can be developed by combining the various statements to form program logic, beginning with either the SequenceStatement, ConditionalStatement, or InterleaveStatement type as the top-level parent. Subsequent levels are created by nesting child statements.

The classes of the Microsoft.LiveFX.ResourceModel.Scripting namespace can be divided into the following categories:

Control Flow Statements

Control flow statements all inherit from the Microsoft.LiveFX.ResourceModel.Scripting.CompoundStatement type. These represent the basic patterns for control flow within Resource Scripts, and consist of the following classes:

  • SequenceStatement - A series of statements which are executed in order.
  • InterleaveStatement - A set of child statements (branches) that are executed in an interleaved fashion (subsequent operations are not executed until all child operations in the current sequence are completed). Interleaved statements are the functional equivalent of an AND join.
  • ConditionalStatement - A statement that executes an If or Else branch based on a condition expression (Expression<Func<Statement, bool>>).

All Resource Scripts begin with a SequenceStatement, ConditionalStatement, or InterleaveStatement instance as the parent, followed by any number of child operations which can include nested control flow statements. The following C# code example shows a sequential statement with three child statements and a nested sequence statement. Multiple statements on the same control flow level are separated by a comma.

// The parent statement:

SequenceStatement myScriptDom = Statement.Sequence(

   // Child statements follow:

   Statement.ReadResourceStatement<MeshObjectResource>(new Uri("https://user-ctp.windows.net/V0.1/Mesh/MeshObjects/Object1"), false),

   Statement.ReadResourceStatement<MeshObjectResource>(new Uri("https://user-ctp.windows.net/V0.1/Mesh/MeshObjects/Object2"), false)

   // A nested sequence statement:

   SequenceStatement.Sequence(

      Statement.CreateResource<MeshObjectResource>(new Uri(https://user-ctp.windows.net/V0.1/Mesh/MeshObjects/Object3), new MeshObjectResource("Another New Resource"))

   )

);

Web Operation Statements

Web Operation statements are designed to handle the most common CRUD-related tasks. These include the following:

CreateResourceStatement - Issues an HTTP POST against the Live Operating Environment and creates a new Resource (Resource).

  • CreateMediaResourceStatement - Issues an HTTP POST against the Live Operating Environment and creates a new Media Link Resource (MediaResource) from an external URL or media stream.
  • ReadResourceStatement - Issues an HTTP GET against the Live Operating Environment and retrieves the specified resource.
  • ReadMediaResourceStatement - Issues an HTTP GET against the Live Operating Environment and retrieves the specified media resource. Note that this statement cannot be executed on the server side.
  • ReadResourceCollectionStatement - Issues an HTTP GET against the Live Operating Environment and retrieves the specified resource collection.
  • UpdateResourceStatement - Issues an HTTP PUT against the Live Operating Environment to update the specified resource.
  • DeleteResourceStatement - Issues an HTTP DELETE against the Live Operating Environment to delete the specified resource.

Synchronization Statements

SynchronizeResourceCollectionStatement issues an HTTP POST against the Live Operating Environment and uploads the local state (FeedSync representation) to the server for synchronization.

Data Flow Constructs

Data flow constructs enable the binding properties of statements. This allows a script developer to expose certain properties of a statement so that it can be used by other statements at script level. The data flow constructs are:

Data Flow Statements

  • AssignStatement - Assigns a LINQ expression (a property or a lambda value) to the property of a target statement.
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker