﻿<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="CorrespondenceModel.Store" 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="NotificationCategories">
          <Key>
            <PropertyRef Name="NotificationCategoryID" />
          </Key>
          <Property Name="NotificationCategoryID" Type="smallint" Nullable="false" />
          <Property Name="Description" Type="varchar" MaxLength="50" Nullable="false" />
          <Property Name="CssClass" Type="varchar" MaxLength="20" />
          <Property Name="IsCancelled" Type="bit" Nullable="false" />
        </EntityType>
        <EntityType Name="Notifications">
          <Key>
            <PropertyRef Name="NotificationID" />
          </Key>
          <Property Name="NotificationID" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="NotificationCategoryID" Type="smallint" Nullable="false" />
          <Property Name="NotificationTypeID" Type="smallint" Nullable="false" />
          <Property Name="UserID" Type="bigint" Nullable="false" />
          <Property Name="EntityID" Type="int" />
          <Property Name="ItemID" Type="bigint" />
          <Property Name="Notification" Type="varchar" MaxLength="1000" Nullable="false" />
          <Property Name="CreatedByID" Type="bigint" Nullable="false" />
          <Property Name="CreatedDate" Type="datetime" Nullable="false" />
          <Property Name="ReadByID" Type="bigint" />
          <Property Name="ReadDate" Type="datetime" />
        </EntityType>
        <!--Errors Found During Generation:
warning 6002: The table/view 'EPWP.Crm.Vw_Notifications' 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="Vw_Notifications">
          <Key>
            <PropertyRef Name="NotificationID" />
            <PropertyRef Name="NotificationCategoryID" />
            <PropertyRef Name="UserID" />
            <PropertyRef Name="Notification" />
            <PropertyRef Name="CreatedDate" />
            <PropertyRef Name="CreatedByID" />
            <PropertyRef Name="NotificationCategory" />
          </Key>
          <Property Name="NotificationID" Type="bigint" Nullable="false" />
          <Property Name="NotificationCategoryID" Type="smallint" Nullable="false" />
          <Property Name="UserID" Type="bigint" Nullable="false" />
          <Property Name="EntityID" Type="int" />
          <Property Name="ItemID" Type="bigint" />
          <Property Name="Notification" Type="varchar" MaxLength="1000" Nullable="false" />
          <Property Name="CreatedDate" Type="datetime" Nullable="false" />
          <Property Name="CreatedByID" Type="bigint" Nullable="false" />
          <Property Name="ReadByID" Type="bigint" />
          <Property Name="ReadDate" Type="datetime" />
          <Property Name="NotificationCategory" Type="varchar" MaxLength="50" Nullable="false" />
          <Property Name="CssClass" Type="varchar" MaxLength="20" />
        </EntityType>
        <Association Name="FK_Notifications_NotificationCategories">
          <End Role="NotificationCategories" Type="Self.NotificationCategories" Multiplicity="1" />
          <End Role="Notifications" Type="Self.Notifications" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="NotificationCategories">
              <PropertyRef Name="NotificationCategoryID" />
            </Principal>
            <Dependent Role="Notifications">
              <PropertyRef Name="NotificationCategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Function Name="Pr_NotificationCreate" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="Crm">
          <Parameter Name="UserID" Type="bigint" Mode="In" />
          <Parameter Name="EntityID" Type="int" Mode="In" />
          <Parameter Name="ItemID" Type="bigint" Mode="In" />
          <Parameter Name="NotificationCategoryID" Type="smallint" Mode="In" />
          <Parameter Name="NotificationTypeID" Type="smallint" Mode="In" />
          <Parameter Name="Notification" Type="varchar" Mode="In" />
          <Parameter Name="NotificationCreatedByUserName" Type="varchar" Mode="In" />
        </Function>
        <Function Name="Pr_NotificationMarkAsRead" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="Crm">
          <Parameter Name="NotificationID" Type="bigint" Mode="In" />
          <Parameter Name="NotificationReadByUserName" Type="varchar" Mode="In" />
        </Function>
        <Function Name="Pr_NotificationSearch" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="Crm">
          <Parameter Name="UserID" Type="bigint" Mode="In" />
          <Parameter Name="EntityID" Type="int" Mode="In" />
          <Parameter Name="ItemID" Type="bigint" Mode="In" />
          <Parameter Name="UnreadOnly" Type="bit" Mode="In" />
        </Function>
        <EntityContainer Name="CorrespondenceModelStoreContainer">
          <EntitySet Name="NotificationCategories" EntityType="Self.NotificationCategories" Schema="Crm" store:Type="Tables" />
          <EntitySet Name="Notifications" EntityType="Self.Notifications" Schema="Crm" store:Type="Tables" />
          <EntitySet Name="Vw_Notifications" EntityType="Self.Vw_Notifications" store:Type="Views" store:Schema="Crm">
            <DefiningQuery>SELECT 
    [Vw_Notifications].[NotificationID] AS [NotificationID], 
    [Vw_Notifications].[NotificationCategoryID] AS [NotificationCategoryID], 
    [Vw_Notifications].[UserID] AS [UserID], 
    [Vw_Notifications].[EntityID] AS [EntityID], 
    [Vw_Notifications].[ItemID] AS [ItemID], 
    [Vw_Notifications].[Notification] AS [Notification], 
    [Vw_Notifications].[CreatedDate] AS [CreatedDate], 
    [Vw_Notifications].[CreatedByID] AS [CreatedByID], 
    [Vw_Notifications].[ReadByID] AS [ReadByID], 
    [Vw_Notifications].[ReadDate] AS [ReadDate], 
    [Vw_Notifications].[NotificationCategory] AS [NotificationCategory], 
    [Vw_Notifications].[CssClass] AS [CssClass]
    FROM [Crm].[Vw_Notifications] AS [Vw_Notifications]</DefiningQuery>
          </EntitySet>
          <AssociationSet Name="FK_Notifications_NotificationCategories" Association="Self.FK_Notifications_NotificationCategories">
            <End Role="NotificationCategories" EntitySet="NotificationCategories" />
            <End Role="Notifications" EntitySet="Notifications" />
          </AssociationSet>
        </EntityContainer>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="Model" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
        <EntityContainer Name="NotificationsContext" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="Vw_Notifications" EntityType="Model.Vw_Notifications" />
          <FunctionImport Name="Pr_NotificationCreate" ReturnType="Collection(Int64)">
            <Parameter Name="UserID" Mode="In" Type="Int64" />
            <Parameter Name="EntityID" Mode="In" Type="Int32" />
            <Parameter Name="ItemID" Mode="In" Type="Int64" />
            <Parameter Name="NotificationCategoryID" Mode="In" Type="Int16" />
            <Parameter Name="NotificationTypeID" Mode="In" Type="Int16" />
            <Parameter Name="Notification" Mode="In" Type="String" />
            <Parameter Name="NotificationCreatedByUserName" Mode="In" Type="String" />
          </FunctionImport>
          <FunctionImport Name="Pr_NotificationMarkAsRead" ReturnType="Collection(Int64)">
            <Parameter Name="NotificationID" Mode="In" Type="Int64" />
            <Parameter Name="NotificationReadByUserName" Mode="In" Type="String" />
          </FunctionImport>
          <FunctionImport Name="Pr_NotificationSearch" EntitySet="Vw_Notifications" ReturnType="Collection(Model.Vw_Notifications)">
            <Parameter Name="UserID" Mode="In" Type="Int64" />
            <Parameter Name="EntityID" Mode="In" Type="Int32" />
            <Parameter Name="ItemID" Mode="In" Type="Int64" />
            <Parameter Name="UnreadOnly" Mode="In" Type="Boolean" />
          </FunctionImport>
          <EntitySet Name="NotificationCategories" EntityType="Model.NotificationCategory" />
          <EntitySet Name="Notifications" EntityType="Model.Notification" />
          <AssociationSet Name="FK_Notifications_NotificationCategories" Association="Model.FK_Notifications_NotificationCategories">
            <End Role="NotificationCategory" EntitySet="NotificationCategories" />
            <End Role="Notification" EntitySet="Notifications" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Vw_Notifications">
          <Key>
            <PropertyRef Name="NotificationID" />
            <PropertyRef Name="NotificationCategoryID" />
            <PropertyRef Name="UserID" />
            <PropertyRef Name="Notification" />
            <PropertyRef Name="CreatedDate" />
            <PropertyRef Name="CreatedByID" />
            <PropertyRef Name="NotificationCategory" />
          </Key>
          <Property Type="Int64" Name="NotificationID" Nullable="false" />
          <Property Type="Int16" Name="NotificationCategoryID" Nullable="false" />
          <Property Type="Int64" Name="UserID" Nullable="false" />
          <Property Type="Int32" Name="EntityID" />
          <Property Type="Int64" Name="ItemID" />
          <Property Type="String" Name="Notification" Nullable="false" MaxLength="1000" FixedLength="false" Unicode="false" />
          <Property Type="DateTime" Name="CreatedDate" Nullable="false" Precision="3" />
          <Property Type="Int64" Name="CreatedByID" Nullable="false" />
          <Property Type="Int64" Name="ReadByID" />
          <Property Type="DateTime" Name="ReadDate" Precision="3" />
          <Property Type="String" Name="NotificationCategory" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="CssClass" MaxLength="20" FixedLength="false" Unicode="false" />
        </EntityType>
        <EntityType Name="NotificationCategory">
          <Key>
            <PropertyRef Name="NotificationCategoryID" />
          </Key>
          <Property Type="Int16" Name="NotificationCategoryID" Nullable="false" />
          <Property Type="String" Name="Description" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="CssClass" MaxLength="20" FixedLength="false" Unicode="false" />
          <Property Type="Boolean" Name="IsCancelled" Nullable="false" />
          <NavigationProperty Name="Notifications" Relationship="Model.FK_Notifications_NotificationCategories" FromRole="NotificationCategory" ToRole="Notification" />
        </EntityType>
        <EntityType Name="Notification">
          <Key>
            <PropertyRef Name="NotificationID" />
          </Key>
          <Property Type="Int64" Name="NotificationID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Type="Int16" Name="NotificationCategoryID" Nullable="false" />
          <Property Type="Int64" Name="UserID" Nullable="false" />
          <Property Type="Int32" Name="EntityID" />
          <Property Type="Int64" Name="ItemID" />
          <Property Type="String" Name="Notification1" Nullable="false" MaxLength="1000" FixedLength="false" Unicode="false" />
          <Property Type="Int64" Name="CreatedByID" Nullable="false" />
          <Property Type="DateTime" Name="CreatedDate" Nullable="false" Precision="3" />
          <Property Type="Int64" Name="ReadByID" />
          <Property Type="DateTime" Name="ReadDate" Precision="3" />
          <NavigationProperty Name="NotificationCategory" Relationship="Model.FK_Notifications_NotificationCategories" FromRole="Notification" ToRole="NotificationCategory" />
          <Property Name="NotificationTypeID" Type="Int16" Nullable="false" />
        </EntityType>
        <Association Name="FK_Notifications_NotificationCategories">
          <End Type="Model.NotificationCategory" Role="NotificationCategory" Multiplicity="1" />
          <End Type="Model.Notification" Role="Notification" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="NotificationCategory">
              <PropertyRef Name="NotificationCategoryID" />
            </Principal>
            <Dependent Role="Notification">
              <PropertyRef Name="NotificationCategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="CorrespondenceModelStoreContainer" CdmEntityContainer="NotificationsContext">
          <EntitySetMapping Name="Vw_Notifications">
            <EntityTypeMapping TypeName="Model.Vw_Notifications">
              <MappingFragment StoreEntitySet="Vw_Notifications">
                <ScalarProperty Name="CssClass" ColumnName="CssClass" />
                <ScalarProperty Name="NotificationCategory" ColumnName="NotificationCategory" />
                <ScalarProperty Name="ReadDate" ColumnName="ReadDate" />
                <ScalarProperty Name="ReadByID" ColumnName="ReadByID" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="Notification" ColumnName="Notification" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="UserID" ColumnName="UserID" />
                <ScalarProperty Name="NotificationCategoryID" ColumnName="NotificationCategoryID" />
                <ScalarProperty Name="NotificationID" ColumnName="NotificationID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <FunctionImportMapping FunctionImportName="Pr_NotificationCreate" FunctionName="CorrespondenceModel.Store.Pr_NotificationCreate">
          </FunctionImportMapping>
          <FunctionImportMapping FunctionImportName="Pr_NotificationMarkAsRead" FunctionName="CorrespondenceModel.Store.Pr_NotificationMarkAsRead" />
          <FunctionImportMapping FunctionImportName="Pr_NotificationSearch" FunctionName="CorrespondenceModel.Store.Pr_NotificationSearch">
          </FunctionImportMapping>
          <EntitySetMapping Name="NotificationCategories">
            <EntityTypeMapping TypeName="Model.NotificationCategory">
              <MappingFragment StoreEntitySet="NotificationCategories">
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
                <ScalarProperty Name="CssClass" ColumnName="CssClass" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="NotificationCategoryID" ColumnName="NotificationCategoryID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Notifications">
            <EntityTypeMapping TypeName="Model.Notification">
              <MappingFragment StoreEntitySet="Notifications">
                <ScalarProperty Name="NotificationTypeID" ColumnName="NotificationTypeID" />
                <ScalarProperty Name="ReadDate" ColumnName="ReadDate" />
                <ScalarProperty Name="ReadByID" ColumnName="ReadByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="Notification1" ColumnName="Notification" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="UserID" ColumnName="UserID" />
                <ScalarProperty Name="NotificationCategoryID" ColumnName="NotificationCategoryID" />
                <ScalarProperty Name="NotificationID" ColumnName="NotificationID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
        </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
    <Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </Connection>
    <Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
        <DesignerProperty Name="EnablePluralization" Value="True" />
        <DesignerProperty Name="IncludeForeignKeysInModel" Value="True" />
        <DesignerProperty Name="CodeGenerationStrategy" Value="None" />
        <DesignerProperty Name="UseLegacyProvider" Value="False" />
      </DesignerInfoPropertySet>
    </Options>
    <!-- Diagram content (shape and connector positions) -->
    <Diagrams>
      <Diagram Name="NotificationsModel" ZoomLevel="73">
        <EntityTypeShape EntityType="Model.Vw_Notifications" Width="1.5" PointX="7.50735394447453" PointY="10.21559593557175" />
        <EntityTypeShape EntityType="Model.NotificationCategory" Width="1.5" PointX="9.6668048098994444" PointY="21.339249993366771" />
        <EntityTypeShape EntityType="Model.Notification" Width="1.5" PointX="1.886313692613651" PointY="7.6283268666026771" />
        <AssociationConnector Association="Model.FK_Notifications_NotificationCategories" />
      </Diagram>
    </Diagrams>
  </Designer>
</edmx:Edmx>