<?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="EmployeeTerritory">
    <EntityType.Methods>
      <EntityMethod
        Name="Delete">
        <EntityMethod.Attributes>
          <Generated />
        </EntityMethod.Attributes>
      </EntityMethod>
    </EntityType.Methods>
    <EntityType.Properties>
      <KeyProperty
        Name="EmployeeID"
        PropertyType=":Int32">
        <KeyProperty.Attributes>
          <Required />
          <NotSearchable />
        </KeyProperty.Attributes>
      </KeyProperty>
      <KeyProperty
        Name="TerritoryID"
        PropertyType=":String">
        <KeyProperty.Attributes>
          <Required />
          <MaxLength
            Value="20" />
        </KeyProperty.Attributes>
      </KeyProperty>
      <NavigationProperty
        Name="Employee"
        Association="FK_EmployeeTerritories_Employees"
        FromEnd="EmployeeTerritories"
        ToEnd="Employees" />
      <NavigationProperty
        Name="Territory"
        Association="FK_EmployeeTerritories_Territories"
        FromEnd="EmployeeTerritories"
        ToEnd="Territories" />
    </EntityType.Properties>
  </EntityType>
  <EntityContainer
    Name="NorthwindData">
    <EntityContainer.Attributes>
      <Partial />
    </EntityContainer.Attributes>
    <EntitySet
      Name="EmployeeTerritories"
      CanDelete="True"
      CanInsert="True"
      CanUpdate="True"
      EntityType="EmployeeTerritory" />
    <QueryOperation
      Name="EmployeeTerritories_Single"
      ReturnType="EmployeeTerritory">
      <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="TerritoryID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="TerritoryID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <BinaryExpression
                NodeType="Equal">
                <BinaryExpression.Left>
                  <ChainExpression>
                    <MemberExpression
                      Member="EmployeeID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="EmployeeID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="EmployeeTerritories" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <QueryOperationParameter
        Name="EmployeeID"
        ParameterType=":Int32?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'EmployeeID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
      <QueryOperationParameter
        Name="TerritoryID"
        ParameterType=":String?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'TerritoryID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
    <QueryOperation
      Name="EmployeeTerritories_SingleOrDefault"
      ReturnType="EmployeeTerritory">
      <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="TerritoryID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="TerritoryID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <BinaryExpression
                NodeType="Equal">
                <BinaryExpression.Left>
                  <ChainExpression>
                    <MemberExpression
                      Member="EmployeeID" />
                  </ChainExpression>
                </BinaryExpression.Left>
                <BinaryExpression.Right>
                  <ParameterExpression
                    Parameter="EmployeeID" />
                </BinaryExpression.Right>
              </BinaryExpression>
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression
            Member="EmployeeTerritories" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <QueryOperationParameter
        Name="EmployeeID"
        ParameterType=":Int32?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'EmployeeID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
      <QueryOperationParameter
        Name="TerritoryID"
        ParameterType=":String?">
        <QueryOperationParameter.Attributes>
          <Description
            Value="The value of the 'TerritoryID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
  </EntityContainer>
  <DataService
    Name="NorthwindDataDataService">
    <DataService.Attributes>
      <Partial />
    </DataService.Attributes>
    <EntitySetMapping
      EntitySet="EmployeeTerritories">
      <EntitySetMapping.Attributes>
        <CsdlEntitySet
          EntityTypeName="EmployeeTerritory"
          EntityTypeNamespace="LightSwitchApplication"
          Name="EmployeeTerritories"
          EntityType="EmployeeTerritory" />
        <CsdlProperty
          Name="EmployeeID"
          Property="EmployeeTerritory/Properties[EmployeeID]" />
        <CsdlProperty
          Name="TerritoryID"
          Property="EmployeeTerritory/Properties[TerritoryID]" />
        <CsdlProperty
          Name="Employee"
          Property="EmployeeTerritory/Properties[Employee]" />
        <CsdlProperty
          Name="Territory"
          Property="EmployeeTerritory/Properties[Territory]" />
      </EntitySetMapping.Attributes>
    </EntitySetMapping>
  </DataService>
</ServiceApplication>