﻿<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="tietokannatModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
  <EntityContainer Name="tietokannat2Entities" annotation:LazyLoadingEnabled="true">
    <EntitySet Name="Aine" EntityType="tietokannatModel.Aine" />
    <EntitySet Name="Liittyy" EntityType="tietokannatModel.Liittyy" />
    <EntitySet Name="Ohje" EntityType="tietokannatModel.Ohje" />
    <EntitySet Name="Resepti" EntityType="tietokannatModel.Resepti" />
    <EntitySet Name="Ruokalaji" EntityType="tietokannatModel.Ruokalaji" />
    <EntitySet Name="Yksikko" EntityType="tietokannatModel.Yksikko" />
    <AssociationSet Name="Liittyy_AineID" Association="tietokannatModel.Liittyy_AineID">
      <End Role="Aine" EntitySet="Aine" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Liittyy_Lyhenne" Association="tietokannatModel.Liittyy_Lyhenne">
      <End Role="Yksikko" EntitySet="Yksikko" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Liittyy_ReseptiID" Association="tietokannatModel.Liittyy_ReseptiID">
      <End Role="Resepti" EntitySet="Resepti" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Ohje_ReseptiID" Association="tietokannatModel.Ohje_ReseptiID">
      <End Role="Resepti" EntitySet="Resepti" />
      <End Role="Ohje" EntitySet="Ohje" />
    </AssociationSet>
    <AssociationSet Name="Resepti_RuokalajiID" Association="tietokannatModel.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="String" Nullable="false" MaxLength="60" Unicode="false" FixedLength="false" />
    <Property Name="Kuvaus" Type="String" MaxLength="250" Unicode="false" FixedLength="false" />
    <Property Name="AineID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
    <NavigationProperty Name="Liittyy" Relationship="tietokannatModel.Liittyy_AineID" FromRole="Aine" ToRole="Liittyy" />
  </EntityType>
  <EntityType Name="Liittyy">
    <Key>
      <PropertyRef Name="Resepti_ReseptiID" />
      <PropertyRef Name="Aine_AineID" />
      <PropertyRef Name="Yksikko_Lyhenne" />
    </Key>
    <Property Name="Maara" Type="Decimal" Precision="5" Scale="2" />
    <Property Name="Resepti_ReseptiID" Type="Int32" Nullable="false" />
    <Property Name="Aine_AineID" Type="Int32" Nullable="false" />
    <Property Name="Yksikko_Lyhenne" Type="String" Nullable="false" MaxLength="3" Unicode="false" FixedLength="true" />
    <NavigationProperty Name="Aine" Relationship="tietokannatModel.Liittyy_AineID" FromRole="Liittyy" ToRole="Aine" />
    <NavigationProperty Name="Yksikko" Relationship="tietokannatModel.Liittyy_Lyhenne" FromRole="Liittyy" ToRole="Yksikko" />
    <NavigationProperty Name="Resepti" Relationship="tietokannatModel.Liittyy_ReseptiID" FromRole="Liittyy" ToRole="Resepti" />
  </EntityType>
  <EntityType Name="Ohje">
    <Key>
      <PropertyRef Name="Vaihenro" />
      <PropertyRef Name="ReseptiID" />
    </Key>
    <Property Name="Vaihenro" Type="Int32" Nullable="false" />
    <Property Name="ReseptiID" Type="Int32" Nullable="false" />
    <Property Name="Ohjeteksti" Type="String" Nullable="false" MaxLength="255" Unicode="false" FixedLength="false" />
    <NavigationProperty Name="Resepti" Relationship="tietokannatModel.Ohje_ReseptiID" FromRole="Ohje" ToRole="Resepti" />
  </EntityType>
  <EntityType Name="Resepti">
    <Key>
      <PropertyRef Name="ReseptiID" />
    </Key>
    <Property Name="Nimi" Type="String" Nullable="false" MaxLength="100" Unicode="false" FixedLength="false" />
    <Property Name="Kuvaus" Type="String" MaxLength="250" Unicode="false" FixedLength="false" />
    <Property Name="Henkilomaara" Type="Int32" />
    <Property Name="ReseptiID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
    <Property Name="RuokalajiID" Type="Int32" Nullable="false" />
    <NavigationProperty Name="Liittyy" Relationship="tietokannatModel.Liittyy_ReseptiID" FromRole="Resepti" ToRole="Liittyy" />
    <NavigationProperty Name="Ohje" Relationship="tietokannatModel.Ohje_ReseptiID" FromRole="Resepti" ToRole="Ohje" />
    <NavigationProperty Name="Ruokalaji" Relationship="tietokannatModel.Resepti_RuokalajiID" FromRole="Resepti" ToRole="Ruokalaji" />
  </EntityType>
  <EntityType Name="Ruokalaji">
    <Key>
      <PropertyRef Name="RuokalajiID" />
    </Key>
    <Property Name="Nimi" Type="String" Nullable="false" MaxLength="100" Unicode="false" FixedLength="false" />
    <Property Name="Kuvaus" Type="String" MaxLength="250" Unicode="false" FixedLength="false" />
    <Property Name="RuokalajiID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
    <NavigationProperty Name="Resepti" Relationship="tietokannatModel.Resepti_RuokalajiID" FromRole="Ruokalaji" ToRole="Resepti" />
  </EntityType>
  <EntityType Name="Yksikko">
    <Key>
      <PropertyRef Name="Lyhenne" />
    </Key>
    <Property Name="Nimi" Type="String" Nullable="false" MaxLength="20" Unicode="false" FixedLength="false" />
    <Property Name="Lyhenne" Type="String" Nullable="false" MaxLength="3" Unicode="false" FixedLength="true" />
    <NavigationProperty Name="Liittyy" Relationship="tietokannatModel.Liittyy_Lyhenne" FromRole="Yksikko" ToRole="Liittyy" />
  </EntityType>
  <Association Name="Liittyy_AineID">
    <End Role="Aine" Type="tietokannatModel.Aine" Multiplicity="1" />
    <End Role="Liittyy" Type="tietokannatModel.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.Yksikko" Multiplicity="1" />
    <End Role="Liittyy" Type="tietokannatModel.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.Resepti" Multiplicity="1" />
    <End Role="Liittyy" Type="tietokannatModel.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.Resepti" Multiplicity="1" />
    <End Role="Ohje" Type="tietokannatModel.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.Ruokalaji" Multiplicity="1" />
    <End Role="Resepti" Type="tietokannatModel.Resepti" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Ruokalaji">
        <PropertyRef Name="RuokalajiID" />
      </Principal>
      <Dependent Role="Resepti">
        <PropertyRef Name="RuokalajiID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
</Schema>