<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="Хранилище DataBaseModel" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
  <EntityType Name="Delivery_Points">
    <Key>
      <PropertyRef Name="Code_Point" />
    </Key>
    <Property Name="Code_Point" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="Name_Point" Type="nvarchar" MaxLength="100" Nullable="false" />
  </EntityType>
  <EntityType Name="Manufacturer">
    <Key>
      <PropertyRef Name="Code_Manufacturer" />
    </Key>
    <Property Name="Code_Manufacturer" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="Name_Manufacturer" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="Orders">
    <Key>
      <PropertyRef Name="Code_Order" />
    </Key>
    <Property Name="Code_Order" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="Date_Order" Type="date" Nullable="false" />
    <Property Name="Amount_Order" Type="decimal" Precision="10" Scale="2" Nullable="false" />
    <Property Name="Amount_Discount" Type="decimal" Precision="3" Scale="2" Nullable="false" />
    <Property Name="Code_Point" Type="int" Nullable="false" />
    <Property Name="Get_Code" Type="int" Nullable="false" />
    <Property Name="Date_Delivery" Type="date" Nullable="false" />
  </EntityType>
  <!--Ошибки, обнаруженные при создании:
предупреждение 6002: В таблице или представлении "userNew.dbo.Orders_Products" не определен первичный ключ. Ключ был выведен, а определение таблицы или представления было создано в режиме только для чтения.-->
  <EntityType Name="Orders_Products">
    <Key>
      <PropertyRef Name="Code_Order" />
      <PropertyRef Name="Code_Product" />
      <PropertyRef Name="Count_Product_Order" />
    </Key>
    <Property Name="Code_Order" Type="int" Nullable="false" />
    <Property Name="Code_Product" Type="int" Nullable="false" />
    <Property Name="Count_Product_Order" Type="int" Nullable="false" />
  </EntityType>
  <EntityType Name="Products">
    <Key>
      <PropertyRef Name="Code_Product" />
    </Key>
    <Property Name="Code_Product" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="Name_Product" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="Description_Product" Type="nvarchar(max)" />
    <Property Name="Code_Manufacturer" Type="int" />
    <Property Name="Price_Product" Type="decimal" Precision="10" Scale="2" Nullable="false" />
    <Property Name="Discount_Product" Type="decimal" Precision="3" Scale="2" Nullable="false" />
    <Property Name="Photo_Product" Type="nvarchar(max)" />
  </EntityType>
  <EntityType Name="Roles">
    <Key>
      <PropertyRef Name="Code_Role" />
    </Key>
    <Property Name="Code_Role" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="Name_Role" Type="nvarchar" MaxLength="25" Nullable="false" />
  </EntityType>
  <EntityType Name="Users">
    <Key>
      <PropertyRef Name="Code_User" />
    </Key>
    <Property Name="Code_User" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="Code_Role" Type="int" Nullable="false" />
    <Property Name="Surname_User" Type="nvarchar" MaxLength="25" Nullable="false" />
    <Property Name="Name_User" Type="nvarchar" MaxLength="25" Nullable="false" />
    <Property Name="Midname_User" Type="nvarchar" MaxLength="25" Nullable="false" />
    <Property Name="Login_User" Type="nvarchar" MaxLength="25" Nullable="false" />
    <Property Name="Password_User" Type="nvarchar" MaxLength="25" Nullable="false" />
  </EntityType>
  <!--Ошибки, обнаруженные при создании:
предупреждение 6002: В таблице или представлении "userNew.dbo.Warehouse" не определен первичный ключ. Ключ был выведен, а определение таблицы или представления было создано в режиме только для чтения.-->
  <EntityType Name="Warehouse">
    <Key>
      <PropertyRef Name="Count_Product" />
    </Key>
    <Property Name="Code_Product" Type="int" />
    <Property Name="Count_Product" Type="int" Nullable="false" />
  </EntityType>
  <Association Name="FK__Orders__Code_Poi__31EC6D26">
    <End Role="Delivery_Points" Type="Self.Delivery_Points" Multiplicity="1" />
    <End Role="Orders" Type="Self.Orders" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Delivery_Points">
        <PropertyRef Name="Code_Point" />
      </Principal>
      <Dependent Role="Orders">
        <PropertyRef Name="Code_Point" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK__Orders_Pr__Code___33D4B598">
    <End Role="Orders" Type="Self.Orders" Multiplicity="1" />
    <End Role="Orders_Products" Type="Self.Orders_Products" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Orders">
        <PropertyRef Name="Code_Order" />
      </Principal>
      <Dependent Role="Orders_Products">
        <PropertyRef Name="Code_Order" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK__Orders_Pr__Code___34C8D9D1">
    <End Role="Products" Type="Self.Products" Multiplicity="1" />
    <End Role="Orders_Products" Type="Self.Orders_Products" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Products">
        <PropertyRef Name="Code_Product" />
      </Principal>
      <Dependent Role="Orders_Products">
        <PropertyRef Name="Code_Product" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK__Products__Code_M__2B3F6F97">
    <End Role="Manufacturer" Type="Self.Manufacturer" Multiplicity="0..1" />
    <End Role="Products" Type="Self.Products" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Manufacturer">
        <PropertyRef Name="Code_Manufacturer" />
      </Principal>
      <Dependent Role="Products">
        <PropertyRef Name="Code_Manufacturer" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK__Users__Code_Role__267ABA7A">
    <End Role="Roles" Type="Self.Roles" Multiplicity="1" />
    <End Role="Users" Type="Self.Users" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Roles">
        <PropertyRef Name="Code_Role" />
      </Principal>
      <Dependent Role="Users">
        <PropertyRef Name="Code_Role" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK__Warehouse__Code___2D27B809">
    <End Role="Products" Type="Self.Products" Multiplicity="0..1" />
    <End Role="Warehouse" Type="Self.Warehouse" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Products">
        <PropertyRef Name="Code_Product" />
      </Principal>
      <Dependent Role="Warehouse">
        <PropertyRef Name="Code_Product" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <EntityContainer Name="Хранилище DataBaseModelContainer">
    <EntitySet Name="Delivery_Points" EntityType="Self.Delivery_Points" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Manufacturer" EntityType="Self.Manufacturer" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Orders" EntityType="Self.Orders" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Products" EntityType="Self.Products" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Roles" EntityType="Self.Roles" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Orders_Products" EntityType="Self.Orders_Products" store:Type="Tables" store:Schema="dbo">
      <DefiningQuery>SELECT 
    [Orders_Products].[Code_Order] AS [Code_Order], 
    [Orders_Products].[Code_Product] AS [Code_Product], 
    [Orders_Products].[Count_Product_Order] AS [Count_Product_Order]
    FROM [dbo].[Orders_Products] AS [Orders_Products]</DefiningQuery>
    </EntitySet>
    <EntitySet Name="Warehouse" EntityType="Self.Warehouse" store:Type="Tables" store:Schema="dbo">
      <DefiningQuery>SELECT 
    [Warehouse].[Code_Product] AS [Code_Product], 
    [Warehouse].[Count_Product] AS [Count_Product]
    FROM [dbo].[Warehouse] AS [Warehouse]</DefiningQuery>
    </EntitySet>
    <AssociationSet Name="FK__Orders__Code_Poi__31EC6D26" Association="Self.FK__Orders__Code_Poi__31EC6D26">
      <End Role="Delivery_Points" EntitySet="Delivery_Points" />
      <End Role="Orders" EntitySet="Orders" />
    </AssociationSet>
    <AssociationSet Name="FK__Orders_Pr__Code___33D4B598" Association="Self.FK__Orders_Pr__Code___33D4B598">
      <End Role="Orders" EntitySet="Orders" />
      <End Role="Orders_Products" EntitySet="Orders_Products" />
    </AssociationSet>
    <AssociationSet Name="FK__Orders_Pr__Code___34C8D9D1" Association="Self.FK__Orders_Pr__Code___34C8D9D1">
      <End Role="Products" EntitySet="Products" />
      <End Role="Orders_Products" EntitySet="Orders_Products" />
    </AssociationSet>
    <AssociationSet Name="FK__Products__Code_M__2B3F6F97" Association="Self.FK__Products__Code_M__2B3F6F97">
      <End Role="Manufacturer" EntitySet="Manufacturer" />
      <End Role="Products" EntitySet="Products" />
    </AssociationSet>
    <AssociationSet Name="FK__Users__Code_Role__267ABA7A" Association="Self.FK__Users__Code_Role__267ABA7A">
      <End Role="Roles" EntitySet="Roles" />
      <End Role="Users" EntitySet="Users" />
    </AssociationSet>
    <AssociationSet Name="FK__Warehouse__Code___2D27B809" Association="Self.FK__Warehouse__Code___2D27B809">
      <End Role="Products" EntitySet="Products" />
      <End Role="Warehouse" EntitySet="Warehouse" />
    </AssociationSet>
  </EntityContainer>
</Schema>