﻿<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="tietokannatModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
  <EntityContainer Name="tietokannatModelStoreContainer">
    <EntitySet Name="Aine" EntityType="tietokannatModel.Store.Aine" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Liittyy" EntityType="tietokannatModel.Store.Liittyy" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Ohje" EntityType="tietokannatModel.Store.Ohje" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Resepti" EntityType="tietokannatModel.Store.Resepti" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Ruokalaji" EntityType="tietokannatModel.Store.Ruokalaji" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Yksikko" EntityType="tietokannatModel.Store.Yksikko" store:Type="Tables" Schema="dbo" />
    <AssociationSet Name="Liittyy_AineID" Association="tietokannatModel.Store.Liittyy_AineID">
      <End Role="Aine" EntitySet="Aine" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Liittyy_Lyhenne" Association="tietokannatModel.Store.Liittyy_Lyhenne">
      <End Role="Yksikko" EntitySet="Yksikko" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Liittyy_ReseptiID" Association="tietokannatModel.Store.Liittyy_ReseptiID">
      <End Role="Resepti" EntitySet="Resepti" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Ohje_ReseptiID" Association="tietokannatModel.Store.Ohje_ReseptiID">
      <End Role="Resepti" EntitySet="Resepti" />
      <End Role="Ohje" EntitySet="Ohje" />
    </AssociationSet>
    <AssociationSet Name="Resepti_RuokalajiID" Association="tietokannatModel.Store.Resepti_RuokalajiID">
      <End Role="Ruokalaji" EntitySet="Ruokalaji" />
      <End Role="Resepti" EntitySet="Resepti" />
    </AssociationSet>
  </EntityContainer>
  <EntityType Name="Aine">
    <Key>
      <PropertyRef Name="AineID" />
    </Key>
    <Property Name="Nimi" Type="varchar" Nullable="false" MaxLength="60" />
    <Property Name="Kuvaus" Type="varchar" MaxLength="250" />
    <Property Name="AineID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
  </EntityType>
  <EntityType Name="Liittyy">
    <Key>
      <PropertyRef Name="Resepti_ReseptiID" />
      <PropertyRef Name="Aine_AineID" />
      <PropertyRef Name="Yksikko_Lyhenne" />
    </Key>
    <Property Name="Maara" Type="numeric" Precision="5" Scale="2" />
    <Property Name="Resepti_ReseptiID" Type="int" Nullable="false" />
    <Property Name="Aine_AineID" Type="int" Nullable="false" />
    <Property Name="Yksikko_Lyhenne" Type="char" Nullable="false" MaxLength="3" />
  </EntityType>
  <EntityType Name="Ohje">
    <Key>
      <PropertyRef Name="Vaihenro" />
      <PropertyRef Name="ReseptiID" />
    </Key>
    <Property Name="Vaihenro" Type="int" Nullable="false" />
    <Property Name="ReseptiID" Type="int" Nullable="false" />
    <Property Name="Ohjeteksti" Type="varchar" Nullable="false" MaxLength="255" />
  </EntityType>
  <EntityType Name="Resepti">
    <Key>
      <PropertyRef Name="ReseptiID" />
    </Key>
    <Property Name="Nimi" Type="varchar" Nullable="false" MaxLength="100" />
    <Property Name="Kuvaus" Type="varchar" MaxLength="250" />
    <Property Name="Henkilomaara" Type="int" />
    <Property Name="ReseptiID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
    <Property Name="RuokalajiID" Type="int" Nullable="false" />
  </EntityType>
  <EntityType Name="Ruokalaji">
    <Key>
      <PropertyRef Name="RuokalajiID" />
    </Key>
    <Property Name="Nimi" Type="varchar" Nullable="false" MaxLength="100" />
    <Property Name="Kuvaus" Type="varchar" MaxLength="250" />
    <Property Name="RuokalajiID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
  </EntityType>
  <EntityType Name="Yksikko">
    <Key>
      <PropertyRef Name="Lyhenne" />
    </Key>
    <Property Name="Nimi" Type="varchar" Nullable="false" MaxLength="20" />
    <Property Name="Lyhenne" Type="char" Nullable="false" MaxLength="3" />
  </EntityType>
  <Association Name="Liittyy_AineID">
    <End Role="Aine" Type="tietokannatModel.Store.Aine" Multiplicity="1" />
    <End Role="Liittyy" Type="tietokannatModel.Store.Liittyy" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Aine">
        <PropertyRef Name="AineID" />
      </Principal>
      <Dependent Role="Liittyy">
        <PropertyRef Name="Aine_AineID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="Liittyy_Lyhenne">
    <End Role="Yksikko" Type="tietokannatModel.Store.Yksikko" Multiplicity="1" />
    <End Role="Liittyy" Type="tietokannatModel.Store.Liittyy" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Yksikko">
        <PropertyRef Name="Lyhenne" />
      </Principal>
      <Dependent Role="Liittyy">
        <PropertyRef Name="Yksikko_Lyhenne" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="Liittyy_ReseptiID">
    <End Role="Resepti" Type="tietokannatModel.Store.Resepti" Multiplicity="1" />
    <End Role="Liittyy" Type="tietokannatModel.Store.Liittyy" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Resepti">
        <PropertyRef Name="ReseptiID" />
      </Principal>
      <Dependent Role="Liittyy">
        <PropertyRef Name="Resepti_ReseptiID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="Ohje_ReseptiID">
    <End Role="Resepti" Type="tietokannatModel.Store.Resepti" Multiplicity="1" />
    <End Role="Ohje" Type="tietokannatModel.Store.Ohje" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Resepti">
        <PropertyRef Name="ReseptiID" />
      </Principal>
      <Dependent Role="Ohje">
        <PropertyRef Name="ReseptiID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="Resepti_RuokalajiID">
    <End Role="Ruokalaji" Type="tietokannatModel.Store.Ruokalaji" Multiplicity="1" />
    <End Role="Resepti" Type="tietokannatModel.Store.Resepti" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Ruokalaji">
        <PropertyRef Name="RuokalajiID" />
      </Principal>
      <Dependent Role="Resepti">
        <PropertyRef Name="RuokalajiID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
</Schema>