<?xml version="1.0" encoding="utf-8"?>
<ServiceApplication
  Name="LightSwitchServiceApplication" xmlns="http://schemas.microsoft.com/LightSwitch/2010/xaml/model">
  <ServiceApplication.Attributes>
    <Partial />
  </ServiceApplication.Attributes>
  <EntityType
    Name="Order">
    <EntityType.Methods>
      <EntityMethod
        Name="Delete">
        <EntityMethod.Attributes>
          <Generated />
        </EntityMethod.Attributes>
      </EntityMethod>
    </EntityType.Methods>
    <EntityType.Properties>
      <KeyProperty
        Name="OrderID"
        IsReadOnly="True"
        PropertyType=":Int32">
        <KeyProperty.Attributes>
          <Hidden />
          <Required />
          <NotSearchable />
        </KeyProperty.Attributes>
      </KeyProperty>
      <EntityProperty
        Name="OrderDate"
        PropertyType=":DateTime?">
        <EntityProperty.Attributes>
          <DateTimeConstraint
            Precision="3"
            PreserveSeconds="True" />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="RequiredDate"
        PropertyType=":DateTime?">
        <EntityProperty.Attributes>
          <DateTimeConstraint
            Precision="3"
            PreserveSeconds="True" />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ShippedDate"
        PropertyType=":DateTime?">
        <EntityProperty.Attributes>
          <DateTimeConstraint
            Precision="3"
            PreserveSeconds="True" />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="Freight"
        PropertyType=":Decimal?">
        <EntityProperty.Attributes>
          <DecimalConstraint
            Precision="19"
            Scale="4" />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ShipName"
        PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength
            Value="40" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ShipAddress"
        PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength
            Value="60" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ShipCity"
        PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength
            Value="15" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ShipRegion"
        PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength
            Value="15" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ShipPostalCode"
        PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength
            Value="10" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ShipCountry"
        PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength
            Value="15" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <NavigationProperty
        Name="Customer"
        Association="FK_Orders_Customers"
        FromEnd="Orders"
        ToEnd="Customers" />
      <NavigationProperty
        Name="Employee"
        Association="FK_Orders_Employees"
        FromEnd="Orders"
        ToEnd="Employees" />
      <NavigationProperty
        Name="Order_Details"
        Association="FK_Order_Details_Orders"
        FromEnd="Orders"
        ToEnd="Order_Details" />
      <NavigationProperty
        Name="Shipper"
        Association="FK_Orders_Shippers"
        FromEnd="Orders"
        ToEnd="Shippers" />
    </EntityType.Properties>
  </EntityType>
  <Association
    Name="FK_Order_Details_Orders">
    <AssociationEnd
      Name="Order_Details"
      Multiplicity="Many"
      EntityType="Order_Detail" />
    <AssociationEnd
      Name="Orders"
      Multiplicity="One"
      EntityType="Order">
      <AssociationEnd.Attributes>
        <DeleteRule />
      </AssociationEnd.Attributes>
    </AssociationEnd>
  </Association>
  <EntityContainer
    Name="NorthwindData">
    <EntityContainer.Attributes>
      <Partial />
    </EntityContainer.Attributes>
    <EntitySet
      Name="Orders"
      CanDelete="True"
      CanInsert="True"
      CanUpdate="True"
      EntityType="Order" />
    <AssociationSet
      Name="FK_Order_Details_Orders"
      Association="FK_Order_Details_Orders">
      <AssociationSetEnd
        Name="Order_Details"
        EntitySet="Order_Details" />
      <AssociationSetEnd
        Name="Orders"
        EntitySet="Orders" />
    </AssociationSet>
    <QueryOperation
      Name="Orders_Single"
      ReturnType="Order">
      <QueryOperation.Attributes>
        <Generated />
        <Description
          Value="Returns the entity whose identity is specified by the parameter(s)." />
      </QueryOperation.Attributes>
      <QueryOperation.FilterExpression>
        <QueryFilterExpressionTree>
          <BinaryExpression
            NodeType="Equal">
            <BinaryExpression.Left>
              <ChainExpression>
                <MemberExpression
                  Member="OrderID" />
              </ChainExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <ParameterExpression
                Parameter="OrderID" />
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="Orders" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <QueryOperationParameter
        Name="OrderID"
        ParameterType=":Int32?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'OrderID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
    <QueryOperation
      Name="Orders_SingleOrDefault"
      ReturnType="Order">
      <QueryOperation.Attributes>
        <Generated />
        <Description
          Value="Returns the entity whose identity is specified by the parameter(s) or null if no such entity exists." />
      </QueryOperation.Attributes>
      <QueryOperation.FilterExpression>
        <QueryFilterExpressionTree>
          <BinaryExpression
            NodeType="Equal">
            <BinaryExpression.Left>
              <ChainExpression>
                <MemberExpression
                  Member="OrderID" />
              </ChainExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <ParameterExpression
                Parameter="OrderID" />
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="Orders" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <QueryOperationParameter
        Name="OrderID"
        ParameterType=":Int32?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'OrderID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
  </EntityContainer>
  <DataService
    Name="NorthwindDataDataService">
    <DataService.Attributes>
      <Partial />
    </DataService.Attributes>
    <EntitySetMapping
      EntitySet="Orders">
      <EntitySetMapping.Attributes>
        <CsdlEntitySet
          EntityTypeName="Order"
          EntityTypeNamespace="LightSwitchApplication"
          Name="Orders"
          EntityType="Order" />
        <CsdlProperty
          Name="OrderID"
          StoreGeneratedPattern="Identity"
          Property="Order/Properties[OrderID]" />
        <CsdlProperty
          Name="OrderDate"
          Property="Order/Properties[OrderDate]" />
        <CsdlProperty
          Name="RequiredDate"
          Property="Order/Properties[RequiredDate]" />
        <CsdlProperty
          Name="ShippedDate"
          Property="Order/Properties[ShippedDate]" />
        <CsdlProperty
          Name="Freight"
          Property="Order/Properties[Freight]" />
        <CsdlProperty
          Name="ShipName"
          Property="Order/Properties[ShipName]" />
        <CsdlProperty
          Name="ShipAddress"
          Property="Order/Properties[ShipAddress]" />
        <CsdlProperty
          Name="ShipCity"
          Property="Order/Properties[ShipCity]" />
        <CsdlProperty
          Name="ShipRegion"
          Property="Order/Properties[ShipRegion]" />
        <CsdlProperty
          Name="ShipPostalCode"
          Property="Order/Properties[ShipPostalCode]" />
        <CsdlProperty
          Name="ShipCountry"
          Property="Order/Properties[ShipCountry]" />
        <CsdlProperty
          Name="Customer"
          Property="Order/Properties[Customer]" />
        <CsdlForeignKeyProperty
          Name="CustomerID" />
        <CsdlProperty
          Name="Employee"
          Property="Order/Properties[Employee]" />
        <CsdlForeignKeyProperty
          Name="EmployeeID" />
        <CsdlProperty
          Name="Order_Details"
          Property="Order/Properties[Order_Details]" />
        <CsdlProperty
          Name="Shipper"
          Property="Order/Properties[Shipper]" />
        <CsdlForeignKeyProperty
          Name="ShipVia" />
      </EntitySetMapping.Attributes>
    </EntitySetMapping>
    <AssociationSetMapping
      AssociationSet="FK_Order_Details_Orders">
      <AssociationSetMapping.Attributes>
        <CsdlAssociation
          Name="FK_Order_Details_Orders"
          Association="FK_Order_Details_Orders" />
        <CsdlAssociationSetEnd
          End="NorthwindData/Members[FK_Order_Details_Orders]/Members[Orders]">
          <CsdlAssociationSetEnd.Attributes>
            <CsdlPropertyRef
              Name="OrderID" />
          </CsdlAssociationSetEnd.Attributes>
        </CsdlAssociationSetEnd>
        <CsdlAssociationSetEnd
          End="NorthwindData/Members[FK_Order_Details_Orders]/Members[Order_Details]">
          <CsdlAssociationSetEnd.Attributes>
            <CsdlPropertyRef
              Name="OrderID" />
          </CsdlAssociationSetEnd.Attributes>
        </CsdlAssociationSetEnd>
      </AssociationSetMapping.Attributes>
    </AssociationSetMapping>
  </DataService>
</ServiceApplication>