<?xml version="1.0" encoding="utf-8" ?>
<ModelFragment xmlns="http://schemas.microsoft.com/LightSwitch/2010/xaml/model"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Application Name="LightSwitchApplication"
               Version="1.0.0.0"
               DefaultNavigationItem="!module/NavigationItems[Tasks]"
               Shell=":Standard"
               Theme=":Blue">
    <Application.Methods>
      <ApplicationMethod Name="ShowEditableCustomersGrid">
        <ApplicationMethod.Attributes>
          <ShowScreenMethod TargetScreen="EditableCustomersGrid" />
        </ApplicationMethod.Attributes>
      </ApplicationMethod>
    </Application.Methods>
    <Application.Attributes>
      <AutomaticDisplayName Expression="(\p{Ll})(\p{Lu})|_+"
                            Replacement="$1 $2" />
    </Application.Attributes>
    <Application.NavigationItems>
      <ApplicationNavigationGroup Name="Tasks"
                                  DefaultItem="!module/NavigationItems[Tasks]/Children[EditableCustomersGrid]">
        <ApplicationNavigationGroup.Attributes>
          <DisplayName Value="Tasks" />
        </ApplicationNavigationGroup.Attributes>
        <ApplicationNavigationLink Command="!module/Commands[ScreenCommandShowEditableCustomersGrid]"
                                   Name="EditableCustomersGrid" />
      </ApplicationNavigationGroup>
      <ApplicationNavigationGroup Name="Administration">
        <ApplicationNavigationGroup.Attributes>
          <DisplayName Value="Administration" />
        </ApplicationNavigationGroup.Attributes>
        <ApplicationNavigationLink Command="Microsoft.LightSwitch.Security:!module/Commands[ScreenCommandShowRolesScreen]"
                                   Name="RolesScreen" />
        <ApplicationNavigationLink Command="Microsoft.LightSwitch.Security:!module/Commands[ScreenCommandShowUsersScreen]"
                                   Name="UsersScreen" />
      </ApplicationNavigationGroup>
    </Application.NavigationItems>
    <ApplicationCommand Name="ScreenCommandShowEditableCustomersGrid"
                        Target="!module/Methods[ShowEditableCustomersGrid]" />
  </Application>

  <EntityContainerGroup Name="DataWorkspace">
    <EntityContainerGroupProperty EntityContainer="Microsoft.LightSwitch.Security:SecurityData"
                             Name="SecurityData">
      <EntityContainerGroupProperty.Attributes>
        <Generated />
        <DisplayName Value="Security Data" />
        <Description Value="Service that provides access to security-related data." />
      </EntityContainerGroupProperty.Attributes>
    </EntityContainerGroupProperty>
    <EntityContainerGroupProperty EntityContainer="NorthwindData"
                                  Name="NorthwindData" />
  </EntityContainerGroup>
  <EntityType Name="Customer">
    <EntityType.Methods>
      <EntityMethod Name="Delete">
        <EntityMethod.Attributes>
          <Generated />
        </EntityMethod.Attributes>
      </EntityMethod>
    </EntityType.Methods>
    <EntityType.Properties>
      <KeyProperty Name="CustomerID"
                   PropertyType=":String">
        <KeyProperty.Attributes>
          <Required />
          <MaxLength IsFixedLength="True"
                     Value="5" />
        </KeyProperty.Attributes>
      </KeyProperty>
      <EntityProperty Name="CompanyName"
                      PropertyType=":String">
        <EntityProperty.Attributes>
          <Required />
          <MaxLength Value="40" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="ContactName"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="30" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="ContactTitle"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="30" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="Address"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="60" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="City"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="15" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="Region"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="15" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="PostalCode"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="10" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="Country"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="15" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="Phone"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="24" />
        </EntityProperty.Attributes>
      </EntityProperty>
      <EntityProperty Name="Fax"
                      PropertyType=":String?">
        <EntityProperty.Attributes>
          <MaxLength Value="24" />
        </EntityProperty.Attributes>
      </EntityProperty>
    </EntityType.Properties>
  </EntityType>
<EntityContainer Name="NorthwindData"
                   IsIntrinsic="False">

    <EntitySet CanDelete="True"
               CanInsert="True"
               CanUpdate="True"
               EntityType="Customer"
               Name="Customers" />
  
    <SubmitOperation Name="SaveChanges" />
  
    <QueryOperation Name="Customers_Single"
                    ReturnType="Customer">
      <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="CustomerID" />
              </ChainExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <ParameterExpression Parameter="CustomerID" />
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression Member="Customers" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <QueryOperationParameter Name="CustomerID"
                               ParameterType=":String?">
        <QueryOperationParameter.Attributes>
          <Description Value="The value of the 'CustomerID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
  
    <QueryOperation Name="Customers_SingleOrDefault"
                    ReturnType="Customer">
      <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="CustomerID" />
              </ChainExpression>
            </BinaryExpression.Left>
            <BinaryExpression.Right>
              <ParameterExpression Parameter="CustomerID" />
            </BinaryExpression.Right>
          </BinaryExpression>
        </QueryFilterExpressionTree>
      </QueryOperation.FilterExpression>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression Member="Customers" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
      <QueryOperationParameter Name="CustomerID"
                               ParameterType=":String?">
        <QueryOperationParameter.Attributes>
          <Description Value="The value of the 'CustomerID' key property of the entity to retrieve." />
        </QueryOperationParameter.Attributes>
      </QueryOperationParameter>
    </QueryOperation>
  
    <QueryOperation Name="Customers_All"
                    ReturnType="Customer*">
      <QueryOperation.Attributes>
        <Generated />
        <Description Value="Returns all entities contained in the entity set." />
      </QueryOperation.Attributes>
      <QueryOperation.Source>
        <QuerySourceExpressionTree>
          <MemberExpression Member="Customers" />
        </QuerySourceExpressionTree>
      </QueryOperation.Source>
    </QueryOperation>
  </EntityContainer>

  
  <DataService DataProvider="EntityFrameworkDataProvider"
               EntityContainer="NorthwindData"
               Name="NorthwindDataDataService">
    <DataService.ConnectionProperties>
      <ConnectionProperty Name="DataProviderName"
                          Value="91510608-8809-4020-8897-fba057e22d54" />
      <ConnectionProperty Name="DataSourceName"
                          Value="067ea0d9-ba62-43f7-9106-34930c60c528" />
      <ConnectionProperty Name="ProviderInvariantName"
                          Value="System.Data.SqlClient" />
      <ConnectionProperty Name="ConnectionStringGuid"
                          Value="d8c54caf-01c3-4ecb-b0e7-fdd352da3024" />
      <ConnectionProperty Name="ProviderManifestToken"
                          Value="2008" />
    </DataService.ConnectionProperties>
    <EntitySetMapping EntitySet="Customers">
      <EntitySetMapping.Attributes>
        <SsdlEntitySet Schema="dbo"
                       Table="Customers" />
        <SsdlProperty MaxLength="5"
                      Name="CustomerID"
                      Nullable="False"
                      Property="Customer/Properties[CustomerID]"
                      Type="nchar" />
        <SsdlProperty MaxLength="40"
                      Name="CompanyName"
                      Nullable="False"
                      Property="Customer/Properties[CompanyName]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="30"
                      Name="ContactName"
                      Nullable="True"
                      Property="Customer/Properties[ContactName]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="30"
                      Name="ContactTitle"
                      Nullable="True"
                      Property="Customer/Properties[ContactTitle]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="60"
                      Name="Address"
                      Nullable="True"
                      Property="Customer/Properties[Address]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="15"
                      Name="City"
                      Nullable="True"
                      Property="Customer/Properties[City]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="15"
                      Name="Region"
                      Nullable="True"
                      Property="Customer/Properties[Region]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="10"
                      Name="PostalCode"
                      Nullable="True"
                      Property="Customer/Properties[PostalCode]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="15"
                      Name="Country"
                      Nullable="True"
                      Property="Customer/Properties[Country]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="24"
                      Name="Phone"
                      Nullable="True"
                      Property="Customer/Properties[Phone]"
                      Type="nvarchar" />
        <SsdlProperty MaxLength="24"
                      Name="Fax"
                      Nullable="True"
                      Property="Customer/Properties[Fax]"
                      Type="nvarchar" />
      </EntitySetMapping.Attributes>
    </EntitySetMapping>
  </DataService>

  <Screen Name="EditableCustomersGrid">
    <Screen.Attributes>
      <SaveChangesTo DataService="NorthwindDataDataService" />
    </Screen.Attributes>
    <Screen.Methods>
      <ScreenMethod Name="Save">
        <ScreenMethod.Attributes>
          <DisplayMethodByDefault Display="True" />
          <Generated />
          <ImageResource ResourceId="Microsoft.LightSwitch.BuiltInImageResources::BuiltInResources/Save.png" />
        </ScreenMethod.Attributes>
      </ScreenMethod>
      <ScreenMethod Name="Refresh">
        <ScreenMethod.Attributes>
          <DisplayMethodByDefault Display="True" />
          <Generated />
          <ImageResource ResourceId="Microsoft.LightSwitch.BuiltInImageResources::BuiltInResources/Refresh.png" />
        </ScreenMethod.Attributes>
      </ScreenMethod>
      <ScreenMethod Name="Close">
        <ScreenMethod.Attributes>
          <DisplayMethodByDefault Display="True" />
          <Generated />
        </ScreenMethod.Attributes>
      </ScreenMethod>
    </Screen.Methods>
    <Screen.Properties>
      <ScreenCollectionProperty Name="Customers"
                                PageSize="45"
                                PropertyType="CollectionView$Customer">
        <ScreenCollectionProperty.Query>
          <ScreenQueryDefinition Name="CustomersQuery"
                                 ReturnType="Customer*">
            <ScreenQueryDefinition.FilterExpression>
              <QueryFilterExpressionTree />
            </ScreenQueryDefinition.FilterExpression>
            <ScreenQueryDefinition.Source>
              <QuerySourceExpressionTree>
                <MemberExpression Member="NorthwindData/Members[Customers_All]" />
              </QuerySourceExpressionTree>
            </ScreenQueryDefinition.Source>
          </ScreenQueryDefinition>
        </ScreenCollectionProperty.Query>
        <ScreenExpressionTree>
          <ChainExpression>
            <CallExpression Target="EditableCustomersGrid/Properties[Customers]/Query" />
          </ChainExpression>
        </ScreenExpressionTree>
      </ScreenCollectionProperty>
    </Screen.Properties>
    <Screen.RootContentItem>
      <ContentItem Kind="Screen"
                   Name="RootContentItem">
        <ContentItem.CommandItems>
          <ContentItem Kind="Command"
                       Name="Save">
            <ContentItem.DataSource>
              <ScreenExpressionTree>
                <ChainExpression>
                  <CallExpression Target="EditableCustomersGrid/Methods[Save]" />
                </ChainExpression>
              </ScreenExpressionTree>
            </ContentItem.DataSource>
          </ContentItem>
          <ContentItem Kind="Command"
                       Name="Refresh">
            <ContentItem.DataSource>
              <ScreenExpressionTree>
                <ChainExpression>
                  <CallExpression Target="EditableCustomersGrid/Methods[Refresh]" />
                </ChainExpression>
              </ScreenExpressionTree>
            </ContentItem.DataSource>
          </ContentItem>
        </ContentItem.CommandItems>
        <ContentItem Kind="Group"
                     Name="ScreenLayout">
          <ContentItem DataType="CollectionView$Customer"
                       Kind="Collection"
                       Name="grid"
                       View=":CollectionCustomContentControl">
            <ContentItem.Attributes>
              <DisplayName Value="CustomersView" />
            </ContentItem.Attributes>
            <ContentItem.CommandItems>
              <ContentItem Kind="Command"
                           Name="Customers_AddAndEditNew">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="EditableCustomersGrid/Properties[Customers]" />
                      <CallExpression Target="AddAndEditNew" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem Kind="Command"
                           Name="Customers_EditSelected">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="EditableCustomersGrid/Properties[Customers]" />
                      <CallExpression Target="EditSelected" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem Kind="Command"
                           Name="Customers_DeleteSelected">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="EditableCustomersGrid/Properties[Customers]" />
                      <CallExpression Target="DeleteSelected" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
            </ContentItem.CommandItems>
            <ContentItem.DataSource>
              <ScreenExpressionTree>
                <ChainExpression>
                  <MemberExpression Member="EditableCustomersGrid/Properties[Customers]" />
                </ChainExpression>
              </ScreenExpressionTree>
            </ContentItem.DataSource>
            <ContentItem.PropertySources>
              <ControlPropertySource Property=":RootControl/Properties[VerticalAlignment]">
                <ScreenExpressionTree>
                  <ChainExpression>
                    <ConstantExpression ResultType=":String"
                                        Value="Stretch" />
                  </ChainExpression>
                </ScreenExpressionTree>
              </ControlPropertySource>
              <ControlPropertySource Property="Microsoft.LightSwitch:RootCustomContentControl/Properties[CustomControl]">
                <ScreenExpressionTree>
                  <ChainExpression>
                    <ConstantExpression ResultType=":String"
                                        Value="LightSwitchApplication.MyScreen.MyControl, Application1.Client" />
                  </ChainExpression>
                </ScreenExpressionTree>
              </ControlPropertySource>
              <ControlPropertySource Property="Microsoft.LightSwitch:RootControl/Properties[HorizontalAlignment]">
                <ScreenExpressionTree>
                  <ChainExpression>
                    <ConstantExpression ResultType=":String"
                                        Value="Stretch" />
                  </ChainExpression>
                </ScreenExpressionTree>
              </ControlPropertySource>
              <ControlPropertySource Property="Microsoft.LightSwitch:RootControl/Properties[AttachedLabelPosition]">
                <ScreenExpressionTree>
                  <ChainExpression>
                    <ConstantExpression ResultType=":String"
                                        Value="Top" />
                  </ChainExpression>
                </ScreenExpressionTree>
              </ControlPropertySource>
            </ContentItem.PropertySources>
            <ContentItem DataType="Customer"
                         Kind="Details"
                         Name="RowTemplate">
              <ContentItem.DataSource>
                <ScreenExpressionTree>
                  <ChainExpression />
                </ScreenExpressionTree>
              </ContentItem.DataSource>
              <ContentItem DataType=":String"
                           Kind="Value"
                           Name="CustomerID">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[CustomerID]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String"
                           Kind="Value"
                           Name="CompanyName">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[CompanyName]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="ContactName">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[ContactName]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="ContactTitle">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[ContactTitle]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="Address">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[Address]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="City">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[City]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="Region">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[Region]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="PostalCode">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[PostalCode]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="Country">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[Country]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="Phone">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[Phone]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
              <ContentItem DataType=":String?"
                           Kind="Value"
                           Name="Fax">
                <ContentItem.DataSource>
                  <ScreenExpressionTree>
                    <ChainExpression>
                      <MemberExpression Member="Customer/Properties[Fax]" />
                    </ChainExpression>
                  </ScreenExpressionTree>
                </ContentItem.DataSource>
              </ContentItem>
            </ContentItem>
          </ContentItem>
        </ContentItem>
      </ContentItem>
    </Screen.RootContentItem>
  </Screen>

</ModelFragment>
