<?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="Product">
    <EntityType.Methods>
      <EntityMethod
        Name="Delete">
        <EntityMethod.Attributes>
          <Generated />
        </EntityMethod.Attributes>
      </EntityMethod>
    </EntityType.Methods>
    <EntityType.Properties>
      <KeyProperty
        Name="ProductID"
        IsReadOnly="True"
        PropertyType=":Int32">
        <KeyProperty.Attributes>
          <Hidden />
          <Required />
          <NotSearchable />
        </KeyProperty.Attributes>
      </KeyProperty>
      <EntityProperty
        Name="ProductName"
        PropertyType=":String">
        <EntityProperty.Attributes>
          <Required />
          <MaxLength
            Value="40" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="QuantityPerUnit"
        PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength
            Value="20" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="UnitPrice"
        PropertyType=":Decimal?">
        <EntityProperty.Attributes>
          <DecimalConstraint
            Precision="19"
            Scale="4" />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="UnitsInStock"
        PropertyType=":Int16?">
        <EntityProperty.Attributes>
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="UnitsOnOrder"
        PropertyType=":Int16?">
        <EntityProperty.Attributes>
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="ReorderLevel"
        PropertyType=":Int16?">
        <EntityProperty.Attributes>
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty
        Name="Discontinued"
        PropertyType=":Boolean">
        <EntityProperty.Attributes>
          <Required />
          <NotSearchable />
        </EntityProperty.Attributes>
      </EntityProperty>
      <NavigationProperty
        Name="Category"
        Association="FK_Products_Categories"
        FromEnd="Products"
        ToEnd="Categories" />
      <NavigationProperty
        Name="Order_Details"
        Association="FK_Order_Details_Products"
        FromEnd="Products"
        ToEnd="Order_Details" />
      <NavigationProperty
        Name="Supplier"
        Association="FK_Products_Suppliers"
        FromEnd="Products"
        ToEnd="Suppliers" />
    </EntityType.Properties>
  </EntityType>
  <Association
    Name="FK_Order_Details_Products">
    <AssociationEnd
      Name="Order_Details"
      Multiplicity="Many"
      EntityType="Order_Detail" />
    <AssociationEnd
      Name="Products"
      Multiplicity="One"
      EntityType="Product">
      <AssociationEnd.Attributes>
        <DeleteRule />
      </AssociationEnd.Attributes>
    </AssociationEnd>
  </Association>
  <EntityContainer
    Name="NorthwindData">
    <EntityContainer.Attributes>
      <Partial />
    </EntityContainer.Attributes>
    <EntitySet
      Name="Products"
      CanDelete="True"
      CanInsert="True"
      CanUpdate="True"
      EntityType="Product" />
    <AssociationSet
      Name="FK_Order_Details_Products"
      Association="FK_Order_Details_Products">
      <AssociationSetEnd
        Name="Order_Details"
        EntitySet="Order_Details" />
      <AssociationSetEnd
        Name="Products"
        EntitySet="Products" />
    </AssociationSet>
    <QueryOperation
      Name="Products_Single"
      ReturnType="Product">
      <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="ProductID" />
              </ChainExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <ParameterExpression
                Parameter="ProductID" />
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="Products" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <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="Products_SingleOrDefault"
      ReturnType="Product">
      <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="ProductID" />
              </ChainExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <ParameterExpression
                Parameter="ProductID" />
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="Products" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <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="Products">
      <EntitySetMapping.Attributes>
        <CsdlEntitySet
          EntityTypeName="Product"
          EntityTypeNamespace="LightSwitchApplication"
          Name="Products"
          EntityType="Product" />
        <CsdlProperty
          Name="ProductID"
          StoreGeneratedPattern="Identity"
          Property="Product/Properties[ProductID]" />
        <CsdlProperty
          Name="ProductName"
          Property="Product/Properties[ProductName]" />
        <CsdlProperty
          Name="QuantityPerUnit"
          Property="Product/Properties[QuantityPerUnit]" />
        <CsdlProperty
          Name="UnitPrice"
          Property="Product/Properties[UnitPrice]" />
        <CsdlProperty
          Name="UnitsInStock"
          Property="Product/Properties[UnitsInStock]" />
        <CsdlProperty
          Name="UnitsOnOrder"
          Property="Product/Properties[UnitsOnOrder]" />
        <CsdlProperty
          Name="ReorderLevel"
          Property="Product/Properties[ReorderLevel]" />
        <CsdlProperty
          Name="Discontinued"
          Property="Product/Properties[Discontinued]" />
        <CsdlProperty
          Name="Category"
          Property="Product/Properties[Category]" />
        <CsdlForeignKeyProperty
          Name="CategoryID" />
        <CsdlProperty
          Name="Order_Details"
          Property="Product/Properties[Order_Details]" />
        <CsdlProperty
          Name="Supplier"
          Property="Product/Properties[Supplier]" />
        <CsdlForeignKeyProperty
          Name="SupplierID" />
      </EntitySetMapping.Attributes>
    </EntitySetMapping>
    <AssociationSetMapping
      AssociationSet="FK_Order_Details_Products">
      <AssociationSetMapping.Attributes>
        <CsdlAssociation
          Name="FK_Order_Details_Products"
          Association="FK_Order_Details_Products" />
        <CsdlAssociationSetEnd
          End="NorthwindData/Members[FK_Order_Details_Products]/Members[Products]">
          <CsdlAssociationSetEnd.Attributes>
            <CsdlPropertyRef
              Name="ProductID" />
          </CsdlAssociationSetEnd.Attributes>
        </CsdlAssociationSetEnd>
        <CsdlAssociationSetEnd
          End="NorthwindData/Members[FK_Order_Details_Products]/Members[Order_Details]">
          <CsdlAssociationSetEnd.Attributes>
            <CsdlPropertyRef
              Name="ProductID" />
          </CsdlAssociationSetEnd.Attributes>
        </CsdlAssociationSetEnd>
      </AssociationSetMapping.Attributes>
    </AssociationSetMapping>
  </DataService>
</ServiceApplication>