<?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_Detail">
    <EntityType.Methods>
      <EntityMethod
        Name="Delete">
        <EntityMethod.Attributes>
          <Generated />
        </EntityMethod.Attributes>
      </EntityMethod>
    </EntityType.Methods>
    <EntityType.Properties>
      <KeyProperty
        Name="OrderID"
        PropertyType=":Int32">
        <KeyProperty.Attributes>
          <Required />
          <NotSearchable />
        </KeyProperty.Attributes>
      </KeyProperty>
      <KeyProperty
        Name="ProductID"
        PropertyType=":Int32">
        <KeyProperty.Attributes>
          <Required />
          <NotSearchable />
        </KeyProperty.Attributes>
      </KeyProperty>
      <EntityProperty
        Name="UnitPrice"
        PropertyType=":Decimal">
        <EntityProperty.Attributes>
          <Required />
          <DecimalConstraint
            Precision="19"
            Scale="4" />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="Quantity"
        PropertyType=":Int16">
        <EntityProperty.Attributes>
          <Required />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="Discount"
        PropertyType=":Single">
        <EntityProperty.Attributes>
          <Required />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <NavigationProperty
        Name="Order"
        Association="FK_Order_Details_Orders"
        FromEnd="Order_Details"
        ToEnd="Orders" />
      <NavigationProperty
        Name="Product"
        Association="FK_Order_Details_Products"
        FromEnd="Order_Details"
        ToEnd="Products" />
    </EntityType.Properties>
  </EntityType>
  <EntityContainer
    Name="NorthwindData">
    <EntityContainer.Attributes>
      <Partial />
    </EntityContainer.Attributes>
    <EntitySet
      Name="Order_Details"
      CanDelete="True"
      CanInsert="True"
      CanUpdate="True"
      EntityType="Order_Detail" />
    <QueryOperation
      Name="Order_Details_Single"
      ReturnType="Order_Detail">
      <QueryOperation.Attributes>
        <Generated />
        <Description
          Value="Returns the entity whose identity is specified by the parameter(s)." />
      </QueryOperation.Attributes>
      <QueryOperation.FilterExpression>
        <QueryFilterExpressionTree>
          <BinaryExpression
            NodeType="And">
            <BinaryExpression.Left>
              <BinaryExpression
                NodeType="Equal">
                <BinaryExpression.Left>
                  <ChainExpression>
                    <MemberExpression
                      Member="ProductID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="ProductID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <BinaryExpression
                NodeType="Equal">
                <BinaryExpression.Left>
                  <ChainExpression>
                    <MemberExpression
                      Member="OrderID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="OrderID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="Order_Details" />
        </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>
      <QueryOperationParameter
        Name="ProductID"
        ParameterType=":Int32?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'ProductID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
    <QueryOperation
      Name="Order_Details_SingleOrDefault"
      ReturnType="Order_Detail">
      <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="And">
            <BinaryExpression.Left>
              <BinaryExpression
                NodeType="Equal">
                <BinaryExpression.Left>
                  <ChainExpression>
                    <MemberExpression
                      Member="ProductID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="ProductID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <BinaryExpression
                NodeType="Equal">
                <BinaryExpression.Left>
                  <ChainExpression>
                    <MemberExpression
                      Member="OrderID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="OrderID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="Order_Details" />
        </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>
      <QueryOperationParameter
        Name="ProductID"
        ParameterType=":Int32?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'ProductID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
  </EntityContainer>
  <DataService
    Name="NorthwindDataDataService">
    <DataService.Attributes>
      <Partial />
    </DataService.Attributes>
    <EntitySetMapping
      EntitySet="Order_Details">
      <EntitySetMapping.Attributes>
        <CsdlEntitySet
          EntityTypeName="Order_Detail"
          EntityTypeNamespace="LightSwitchApplication"
          Name="Order_Details"
          EntityType="Order_Detail" />
        <CsdlProperty
          Name="OrderID"
          Property="Order_Detail/Properties[OrderID]" />
        <CsdlProperty
          Name="ProductID"
          Property="Order_Detail/Properties[ProductID]" />
        <CsdlProperty
          Name="UnitPrice"
          Property="Order_Detail/Properties[UnitPrice]" />
        <CsdlProperty
          Name="Quantity"
          Property="Order_Detail/Properties[Quantity]" />
        <CsdlProperty
          Name="Discount"
          Property="Order_Detail/Properties[Discount]" />
        <CsdlProperty
          Name="Order"
          Property="Order_Detail/Properties[Order]" />
        <CsdlProperty
          Name="Product"
          Property="Order_Detail/Properties[Product]" />
      </EntitySetMapping.Attributes>
    </EntitySetMapping>
  </DataService>
</ServiceApplication>