﻿<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="ohjaus5Model.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="ohjaus5ModelStoreContainer">
    <EntitySet Name="Aine" EntityType="ohjaus5Model.Store.Aine" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Liittyy" EntityType="ohjaus5Model.Store.Liittyy" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Ohje" EntityType="ohjaus5Model.Store.Ohje" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Resepti" EntityType="ohjaus5Model.Store.Resepti" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Ruokalaji" EntityType="ohjaus5Model.Store.Ruokalaji" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="sysdiagrams" EntityType="ohjaus5Model.Store.sysdiagrams" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="Yksikko" EntityType="ohjaus5Model.Store.Yksikko" store:Type="Tables" Schema="dbo" />
    <EntitySet Name="tiedot" EntityType="ohjaus5Model.Store.tiedot" store:Type="Views" store:Schema="dbo" store:Name="tiedot">
      <DefiningQuery>SELECT 
      [tiedot].[Nimi] AS [Nimi], 
      [tiedot].[Kuvaus] AS [Kuvaus], 
      [tiedot].[Henkilomaara] AS [Henkilomaara], 
      [tiedot].[ReseptiID] AS [ReseptiID], 
      [tiedot].[RuokalajiID] AS [RuokalajiID], 
      [tiedot].[Expr1] AS [Expr1], 
      [tiedot].[Expr2] AS [Expr2], 
      [tiedot].[Expr3] AS [Expr3], 
      [tiedot].[Expr4] AS [Expr4], 
      [tiedot].[Expr5] AS [Expr5], 
      [tiedot].[AineID] AS [AineID], 
      [tiedot].[Maara] AS [Maara], 
      [tiedot].[Resepti_ReseptiID] AS [Resepti_ReseptiID], 
      [tiedot].[Aine_AineID] AS [Aine_AineID], 
      [tiedot].[Yksikko_Lyhenne] AS [Yksikko_Lyhenne]
      FROM [dbo].[tiedot] AS [tiedot]</DefiningQuery>
    </EntitySet>
    <AssociationSet Name="Liittyy_AineID" Association="ohjaus5Model.Store.Liittyy_AineID">
      <End Role="Aine" EntitySet="Aine" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Liittyy_Lyhenne" Association="ohjaus5Model.Store.Liittyy_Lyhenne">
      <End Role="Yksikko" EntitySet="Yksikko" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Liittyy_ReseptiID" Association="ohjaus5Model.Store.Liittyy_ReseptiID">
      <End Role="Resepti" EntitySet="Resepti" />
      <End Role="Liittyy" EntitySet="Liittyy" />
    </AssociationSet>
    <AssociationSet Name="Ohje_ReseptiID" Association="ohjaus5Model.Store.Ohje_ReseptiID">
      <End Role="Resepti" EntitySet="Resepti" />
      <End Role="Ohje" EntitySet="Ohje" />
    </AssociationSet>
    <AssociationSet Name="Resepti_RuokalajiID" Association="ohjaus5Model.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="sysdiagrams">
    <Key>
      <PropertyRef Name="diagram_id" />
    </Key>
    <Property Name="name" Type="nvarchar" Nullable="false" MaxLength="128" />
    <Property Name="principal_id" Type="int" Nullable="false" />
    <Property Name="diagram_id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
    <Property Name="version" Type="int" />
    <Property Name="definition" Type="varbinary(max)" />
  </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>
  <!--Errors Found During Generation:
      warning 6002: The table/view 'C:\MYTEMP\OHJAUS5.MDF.dbo.tiedot' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.
      -->
  <EntityType Name="tiedot">
    <Key>
      <PropertyRef Name="Nimi" />
      <PropertyRef Name="ReseptiID" />
      <PropertyRef Name="RuokalajiID" />
      <PropertyRef Name="Expr1" />
      <PropertyRef Name="Expr3" />
      <PropertyRef Name="Expr4" />
      <PropertyRef Name="AineID" />
      <PropertyRef Name="Resepti_ReseptiID" />
      <PropertyRef Name="Aine_AineID" />
      <PropertyRef Name="Yksikko_Lyhenne" />
    </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" />
    <Property Name="RuokalajiID" Type="int" Nullable="false" />
    <Property Name="Expr1" Type="varchar" Nullable="false" MaxLength="100" />
    <Property Name="Expr2" Type="varchar" MaxLength="250" />
    <Property Name="Expr3" Type="int" Nullable="false" />
    <Property Name="Expr4" Type="varchar" Nullable="false" MaxLength="60" />
    <Property Name="Expr5" Type="varchar" MaxLength="250" />
    <Property Name="AineID" Type="int" Nullable="false" />
    <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>
  <Association Name="Liittyy_AineID">
    <End Role="Aine" Type="ohjaus5Model.Store.Aine" Multiplicity="1" />
    <End Role="Liittyy" Type="ohjaus5Model.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="ohjaus5Model.Store.Yksikko" Multiplicity="1" />
    <End Role="Liittyy" Type="ohjaus5Model.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="ohjaus5Model.Store.Resepti" Multiplicity="1" />
    <End Role="Liittyy" Type="ohjaus5Model.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="ohjaus5Model.Store.Resepti" Multiplicity="1" />
    <End Role="Ohje" Type="ohjaus5Model.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="ohjaus5Model.Store.Ruokalaji" Multiplicity="1" />
    <End Role="Resepti" Type="ohjaus5Model.Store.Resepti" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Ruokalaji">
        <PropertyRef Name="RuokalajiID" />
      </Principal>
      <Dependent Role="Resepti">
        <PropertyRef Name="RuokalajiID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
</Schema>