<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="CountryCityModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
  <EntityType Name="City">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Type="Int32" Nullable="false" />
    <Property Name="StateId" Type="Int32" Nullable="false" />
    <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
    <NavigationProperty Name="State" Relationship="Self.FK_City_State" FromRole="City" ToRole="State" />
  </EntityType>
  <EntityType Name="Country">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Type="Int32" Nullable="false" />
    <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
    <NavigationProperty Name="States" Relationship="Self.FK_State_State" FromRole="Country" ToRole="State" />
  </EntityType>
  <EntityType Name="State">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Type="Int32" Nullable="false" />
    <Property Name="CountryId" Type="Int32" Nullable="false" />
    <Property Name="Name" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
    <NavigationProperty Name="Cities" Relationship="Self.FK_City_State" FromRole="State" ToRole="City" />
    <NavigationProperty Name="Country" Relationship="Self.FK_State_State" FromRole="State" ToRole="Country" />
  </EntityType>
  <Association Name="FK_City_State">
    <End Role="State" Type="Self.State" Multiplicity="1" />
    <End Role="City" Type="Self.City" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="State">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="City">
        <PropertyRef Name="StateId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_State_State">
    <End Role="Country" Type="Self.Country" Multiplicity="1" />
    <End Role="State" Type="Self.State" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Country">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="State">
        <PropertyRef Name="CountryId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <EntityContainer Name="CountryCityEntities" annotation:LazyLoadingEnabled="true">
    <EntitySet Name="Cities" EntityType="Self.City" />
    <EntitySet Name="Countries" EntityType="Self.Country" />
    <EntitySet Name="States" EntityType="Self.State" />
    <AssociationSet Name="FK_City_State" Association="Self.FK_City_State">
      <End Role="State" EntitySet="States" />
      <End Role="City" EntitySet="Cities" />
    </AssociationSet>
    <AssociationSet Name="FK_State_State" Association="Self.FK_State_State">
      <End Role="Country" EntitySet="Countries" />
      <End Role="State" EntitySet="States" />
    </AssociationSet>
  </EntityContainer>
</Schema>