﻿<?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="Model.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
        <EntityContainer Name="ModelStoreContainer">
          <EntitySet Name="Comments" EntityType="Model.Store.Comments" store:Type="Tables" Schema="Crm" />
          <EntitySet Name="Messages" EntityType="Model.Store.Messages" store:Type="Tables" Schema="Crm" />
          <EntitySet Name="MessageTemplates" EntityType="Model.Store.MessageTemplates" store:Type="Tables" Schema="Crm" />
          <EntitySet Name="MessageTypes" EntityType="Model.Store.MessageTypes" store:Type="Tables" Schema="Crm" />
          <EntitySet Name="Queries" EntityType="Model.Store.Queries" store:Type="Tables" Schema="Crm" />
          <EntitySet Name="QuerySources" EntityType="Model.Store.QuerySources" store:Type="Tables" Schema="Crm" />
          <EntitySet Name="QueryStatus" EntityType="Model.Store.QueryStatus" store:Type="Tables" Schema="Crm" />
          <EntitySet Name="QueryTypes" EntityType="Model.Store.QueryTypes" store:Type="Tables" Schema="Crm" />
          <AssociationSet Name="FK_Messages_MessageTypes" Association="Model.Store.FK_Messages_MessageTypes">
            <End Role="MessageTypes" EntitySet="MessageTypes" />
            <End Role="Messages" EntitySet="Messages" />
          </AssociationSet>
          <AssociationSet Name="FK_Queries_QuerySources" Association="Model.Store.FK_Queries_QuerySources">
            <End Role="QuerySources" EntitySet="QuerySources" />
            <End Role="Queries" EntitySet="Queries" />
          </AssociationSet>
          <AssociationSet Name="FK_Queries_QueryStatus" Association="Model.Store.FK_Queries_QueryStatus">
            <End Role="QueryStatus" EntitySet="QueryStatus" />
            <End Role="Queries" EntitySet="Queries" />
          </AssociationSet>
          <AssociationSet Name="FK_Queries_QueryTypes" Association="Model.Store.FK_Queries_QueryTypes">
            <End Role="QueryTypes" EntitySet="QueryTypes" />
            <End Role="Queries" EntitySet="Queries" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Comments">
          <Key>
            <PropertyRef Name="CommentID" />
          </Key>
          <Property Name="CommentID" Type="bigint" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="EntityID" Type="int" Nullable="false" />
          <Property Name="ItemID" Type="bigint" Nullable="false" />
          <Property Name="Comment" Type="varchar" Nullable="false" MaxLength="2000" />
          <Property Name="IsCancelled" Type="bit" Nullable="false" />
          <Property Name="CreatedByID" Type="bigint" Nullable="false" />
          <Property Name="CreatedDate" Type="datetime" Nullable="false" />
          <Property Name="UpdatedByID" Type="bigint" Nullable="false" />
          <Property Name="UpdatedDate" Type="datetime" Nullable="false" />
        </EntityType>
        <EntityType Name="Messages">
          <Key>
            <PropertyRef Name="MessageID" />
          </Key>
          <Property Name="MessageID" Type="bigint" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="MessageTypeID" Type="tinyint" Nullable="false" />
          <Property Name="EntityID" Type="int" />
          <Property Name="ItemID" Type="bigint" />
          <Property Name="Sender" Type="varchar" MaxLength="255" />
          <Property Name="Recipients" Type="varchar(max)" />
          <Property Name="CC" Type="varchar(max)" />
          <Property Name="BCC" Type="varchar(max)" />
          <Property Name="Subject" Type="varchar" Nullable="false" MaxLength="1000" />
          <Property Name="Message" Type="varchar(max)" />
          <Property Name="IsHtml" Type="bit" Nullable="false" />
          <Property Name="SentDate" Type="datetime" />
          <Property Name="Retries" Type="int" Nullable="false" />
          <Property Name="IsCancelled" Type="bit" Nullable="false" />
          <Property Name="CreatedByID" Type="bigint" Nullable="false" />
          <Property Name="CreatedDate" Type="datetime" Nullable="false" />
          <Property Name="UpdatedByID" Type="bigint" Nullable="false" />
          <Property Name="UpdatedDate" Type="datetime" Nullable="false" />
        </EntityType>
        <EntityType Name="MessageTemplates">
          <Key>
            <PropertyRef Name="MessageTemplateID" />
          </Key>
          <Property Name="MessageTemplateID" Type="int" Nullable="false" />
          <Property Name="Description" Type="varchar" Nullable="false" MaxLength="100" />
          <Property Name="Subject" Type="varchar" Nullable="false" MaxLength="1000" />
          <Property Name="Message" Type="varchar(max)" Nullable="false" />
          <Property Name="RecipientSqlScript" Type="varchar(max)" />
          <Property Name="DatasetSqlScript" Type="varchar(max)" />
          <Property Name="IsSystemTemplate" Type="bit" Nullable="false" />
          <Property Name="IsCancelled" Type="bit" Nullable="false" />
        </EntityType>
        <EntityType Name="MessageTypes">
          <Key>
            <PropertyRef Name="MessageTypeID" />
          </Key>
          <Property Name="MessageTypeID" Type="tinyint" Nullable="false" />
          <Property Name="Description" Type="varchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Queries">
          <Key>
            <PropertyRef Name="QueryID" />
          </Key>
          <Property Name="QueryID" Type="bigint" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="QueryReference" Type="varchar" MaxLength="53" StoreGeneratedPattern="Computed" />
          <Property Name="QueryTypeID" Type="smallint" Nullable="false" />
          <Property Name="QueryStatusID" Type="smallint" Nullable="false" />
          <Property Name="QuerySourceID" Type="smallint" Nullable="false" />
          <Property Name="EntityID" Type="smallint" Nullable="false" />
          <Property Name="ItemID" Type="bigint" Nullable="false" />
          <Property Name="AssignedToUserRoleID" Type="smallint" Nullable="false" />
          <Property Name="AssignedToUserID" Type="bigint" />
          <Property Name="AssignedToUserDate" Type="datetime" />
          <Property Name="CompletedByID" Type="bigint" />
          <Property Name="CompletedDate" Type="datetime" />
          <Property Name="Description" Type="varchar" Nullable="false" MaxLength="2000" />
          <Property Name="ResponseEmailAddresses" Type="varchar" MaxLength="500" />
          <Property Name="ResponseContactNumbers" Type="varchar" MaxLength="500" />
          <Property Name="LatestComment" Type="varchar" Nullable="false" MaxLength="500" />
          <Property Name="CreatedByID" Type="bigint" Nullable="false" />
          <Property Name="CreatedDate" Type="datetime" Nullable="false" />
          <Property Name="UpdatedByID" Type="bigint" Nullable="false" />
          <Property Name="UpdatedDate" Type="datetime" Nullable="false" />
        </EntityType>
        <EntityType Name="QuerySources">
          <Key>
            <PropertyRef Name="QuerySourceID" />
          </Key>
          <Property Name="QuerySourceID" Type="smallint" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="Description" Type="varchar" Nullable="false" MaxLength="50" />
          <Property Name="IsCancelled" Type="bit" Nullable="false" />
        </EntityType>
        <EntityType Name="QueryStatus">
          <Key>
            <PropertyRef Name="QueryStatusID" />
          </Key>
          <Property Name="QueryStatusID" Type="smallint" Nullable="false" />
          <Property Name="Description" Type="varchar" Nullable="false" MaxLength="50" />
          <Property Name="IsCancelled" Type="bit" Nullable="false" />
        </EntityType>
        <EntityType Name="QueryTypes">
          <Key>
            <PropertyRef Name="QueryTypeID" />
          </Key>
          <Property Name="QueryTypeID" Type="smallint" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="Description" Type="varchar" Nullable="false" MaxLength="50" />
          <Property Name="DefaultAssignedToUserRoleID" Type="smallint" Nullable="false" />
          <Property Name="DefaultEscalatedToUserRoleID" Type="smallint" Nullable="false" />
          <Property Name="MessageTemplateID" Type="int" Nullable="false" />
          <Property Name="CustomPostScript" Type="varchar(max)" />
          <Property Name="IsCancelled" Type="bit" Nullable="false" />
        </EntityType>
        <Association Name="FK_Messages_MessageTypes">
          <End Role="MessageTypes" Type="Model.Store.MessageTypes" Multiplicity="1" />
          <End Role="Messages" Type="Model.Store.Messages" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="MessageTypes">
              <PropertyRef Name="MessageTypeID" />
            </Principal>
            <Dependent Role="Messages">
              <PropertyRef Name="MessageTypeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Queries_QuerySources">
          <End Role="QuerySources" Type="Model.Store.QuerySources" Multiplicity="1" />
          <End Role="Queries" Type="Model.Store.Queries" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="QuerySources">
              <PropertyRef Name="QuerySourceID" />
            </Principal>
            <Dependent Role="Queries">
              <PropertyRef Name="QuerySourceID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Queries_QueryStatus">
          <End Role="QueryStatus" Type="Model.Store.QueryStatus" Multiplicity="1" />
          <End Role="Queries" Type="Model.Store.Queries" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="QueryStatus">
              <PropertyRef Name="QueryStatusID" />
            </Principal>
            <Dependent Role="Queries">
              <PropertyRef Name="QueryStatusID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Queries_QueryTypes">
          <End Role="QueryTypes" Type="Model.Store.QueryTypes" Multiplicity="1" />
          <End Role="Queries" Type="Model.Store.Queries" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="QueryTypes">
              <PropertyRef Name="QueryTypeID" />
            </Principal>
            <Dependent Role="Queries">
              <PropertyRef Name="QueryTypeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Function Name="Pr_MessageSearch" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="Crm">
          <Parameter Name="EntityID" Type="int" Mode="In" />
          <Parameter Name="ItemID" Type="bigint" Mode="In" />
          <Parameter Name="Sender" Type="varchar" Mode="In" />
          <Parameter Name="Recipients" Type="varchar(max)" Mode="In" />
          <Parameter Name="IsHtml" Type="bit" Mode="In" />
          <Parameter Name="StartDate" Type="datetime" Mode="In" />
          <Parameter Name="EndDate" Type="datetime" Mode="In" />
        </Function>
        <Function Name="Pr_MessageTemplateSqlTester" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="Crm">
          <Parameter Name="MessageTemplateID" Type="bigint" Mode="In" />
        </Function>
        <Function Name="Pr_MessageTemplateTester" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="Crm">
          <Parameter Name="EntityID" Type="smallint" Mode="In" />
          <Parameter Name="ItemID" Type="bigint" Mode="In" />
          <Parameter Name="MessageTemplateID" Type="bigint" Mode="In" />
        </Function>
      </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="AfxAdminCrmContext" annotation:LazyLoadingEnabled="false">
          <EntitySet Name="Comments" EntityType="Model.Comment" />
          <EntitySet Name="Messages" EntityType="Model.Message" />
          <EntitySet Name="MessageTemplates" EntityType="Model.MessageTemplate" />
          <EntitySet Name="MessageTypes" EntityType="Model.MessageType" />
          <EntitySet Name="Queries" EntityType="Model.Query" />
          <EntitySet Name="QuerySources" EntityType="Model.QuerySource" />
          <EntitySet Name="QueryStatus" EntityType="Model.QueryStatus" />
          <EntitySet Name="QueryTypes" EntityType="Model.QueryType" />
          <AssociationSet Name="FK_Messages_MessageTypes" Association="Model.FK_Messages_MessageTypes">
            <End Role="MessageTypes" EntitySet="MessageTypes" />
            <End Role="Messages" EntitySet="Messages" />
          </AssociationSet>
          <AssociationSet Name="FK_Queries_QuerySources" Association="Model.FK_Queries_QuerySources">
            <End Role="QuerySources" EntitySet="QuerySources" />
            <End Role="Queries" EntitySet="Queries" />
          </AssociationSet>
          <AssociationSet Name="FK_Queries_QueryStatus" Association="Model.FK_Queries_QueryStatus">
            <End Role="QueryStatus" EntitySet="QueryStatus" />
            <End Role="Queries" EntitySet="Queries" />
          </AssociationSet>
          <AssociationSet Name="FK_Queries_QueryTypes" Association="Model.FK_Queries_QueryTypes">
            <End Role="QueryTypes" EntitySet="QueryTypes" />
            <End Role="Queries" EntitySet="Queries" />
          </AssociationSet>
          <FunctionImport Name="Pr_MessageTemplateSqlTester" ReturnType="Collection(Model.MessageTemplateSqlTest)">
          <Parameter Name="MessageTemplateID" Mode="In" Type="Int64" />
          </FunctionImport>
          <FunctionImport Name="Pr_MessageTemplateTester" EntitySet="MessageTemplates" ReturnType="Collection(Model.MessageTemplate)">
            <Parameter Name="EntityID" Mode="In" Type="Int16" />
            <Parameter Name="ItemID" Mode="In" Type="Int64" />
            <Parameter Name="MessageTemplateID" Mode="In" Type="Int64" />
          </FunctionImport>
          <FunctionImport Name="Pr_MessageSearch" ReturnType="Collection(Model.Pr_MessageSearch_Result)">
            <Parameter Name="EntityID" Mode="In" Type="Int32" />
            <Parameter Name="ItemID" Mode="In" Type="Int64" />
            <Parameter Name="Sender" Mode="In" Type="String" />
            <Parameter Name="Recipients" Mode="In" Type="String" />
            <Parameter Name="IsHtml" Mode="In" Type="Boolean" />
            <Parameter Name="StartDate" Mode="In" Type="DateTime" />
            <Parameter Name="EndDate" Mode="In" Type="DateTime" />
          </FunctionImport>
        </EntityContainer>
        <EntityType Name="Comment">
          <Key>
            <PropertyRef Name="CommentID" />
          </Key>
          <Property Name="CommentID" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="EntityID" Type="Int32" Nullable="false" />
          <Property Name="ItemID" Type="Int64" Nullable="false" />
          <Property Name="Comment1" Type="String" Nullable="false" MaxLength="2000" Unicode="false" FixedLength="false" />
          <Property Name="IsCancelled" Type="Boolean" Nullable="false" />
          <Property Name="CreatedByID" Type="Int64" Nullable="false" />
          <Property Name="CreatedDate" Type="DateTime" Nullable="false" />
          <Property Name="UpdatedByID" Type="Int64" Nullable="false" />
          <Property Name="UpdatedDate" Type="DateTime" Nullable="false" />
        </EntityType>
        <EntityType Name="Message">
          <Key>
            <PropertyRef Name="MessageID" />
          </Key>
          <Property Name="MessageID" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="MessageTypeID" Type="Byte" Nullable="false" />
          <Property Name="EntityID" Type="Int32" />
          <Property Name="ItemID" Type="Int64" />
          <Property Name="Sender" Type="String" MaxLength="255" Unicode="false" FixedLength="false" />
          <Property Name="Recipients" Type="String" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="CC" Type="String" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="BCC" Type="String" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="Subject" Type="String" Nullable="false" MaxLength="1000" Unicode="false" FixedLength="false" />
          <Property Name="Message1" Type="String" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="IsHtml" Type="Boolean" Nullable="false" />
          <Property Name="SentDate" Type="DateTime" />
          <Property Name="Retries" Type="Int32" Nullable="false" />
          <Property Name="IsCancelled" Type="Boolean" Nullable="false" />
          <Property Name="CreatedByID" Type="Int64" Nullable="false" />
          <Property Name="CreatedDate" Type="DateTime" Nullable="false" />
          <Property Name="UpdatedByID" Type="Int64" Nullable="false" />
          <Property Name="UpdatedDate" Type="DateTime" Nullable="false" />
          <NavigationProperty Name="MessageType" Relationship="Model.FK_Messages_MessageTypes" FromRole="Messages" ToRole="MessageTypes" />
        </EntityType>
        <EntityType Name="MessageTemplate">
          <Key>
            <PropertyRef Name="MessageTemplateID" />
          </Key>
          <Property Name="MessageTemplateID" Type="Int32" Nullable="false" />
          <Property Name="Description" Type="String" Nullable="false" MaxLength="100" Unicode="false" FixedLength="false" />
          <Property Name="Subject" Type="String" Nullable="false" MaxLength="1000" Unicode="false" FixedLength="false" />
          <Property Name="Message" Type="String" Nullable="false" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="RecipientSqlScript" Type="String" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="DatasetSqlScript" Type="String" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="IsSystemTemplate" Type="Boolean" Nullable="false" />
          <Property Name="IsCancelled" Type="Boolean" Nullable="false" />
        </EntityType>
        <EntityType Name="MessageType">
          <Key>
            <PropertyRef Name="MessageTypeID" />
          </Key>
          <Property Name="MessageTypeID" Type="Byte" Nullable="false" />
          <Property Name="Description" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" />
          <NavigationProperty Name="Messages" Relationship="Model.FK_Messages_MessageTypes" FromRole="MessageTypes" ToRole="Messages" >
            <Documentation>
              <LongDescription>[ScriptIgnore]</LongDescription>
            </Documentation>
          </NavigationProperty>
        </EntityType>
        <EntityType Name="Query">
          <Key>
            <PropertyRef Name="QueryID" />
          </Key>
          <Property Name="QueryID" Type="Int64" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="QueryReference" Type="String" MaxLength="53" Unicode="false" FixedLength="false" annotation:StoreGeneratedPattern="Computed" />
          <Property Name="QueryTypeID" Type="Int16" Nullable="false" />
          <Property Name="QueryStatusID" Type="Int16" Nullable="false" />
          <Property Name="QuerySourceID" Type="Int16" Nullable="false" />
          <Property Name="EntityID" Type="Int16" Nullable="false" />
          <Property Name="ItemID" Type="Int64" Nullable="false" />
          <Property Name="AssignedToUserRoleID" Type="Int16" Nullable="false" />
          <Property Name="AssignedToUserID" Type="Int64" />
          <Property Name="AssignedToUserDate" Type="DateTime" />
          <Property Name="CompletedByID" Type="Int64" />
          <Property Name="CompletedDate" Type="DateTime" />
          <Property Name="Description" Type="String" Nullable="false" MaxLength="2000" Unicode="false" FixedLength="false" />
          <Property Name="ResponseEmailAddresses" Type="String" MaxLength="500" Unicode="false" FixedLength="false" />
          <Property Name="ResponseContactNumbers" Type="String" MaxLength="500" Unicode="false" FixedLength="false" />
          <Property Name="LatestComment" Type="String" Nullable="false" MaxLength="500" Unicode="false" FixedLength="false" />
          <Property Name="CreatedByID" Type="Int64" Nullable="false" />
          <Property Name="CreatedDate" Type="DateTime" Nullable="false" />
          <Property Name="UpdatedByID" Type="Int64" Nullable="false" />
          <Property Name="UpdatedDate" Type="DateTime" Nullable="false" />
          <NavigationProperty Name="QuerySource" Relationship="Model.FK_Queries_QuerySources" FromRole="Queries" ToRole="QuerySources" />
          <NavigationProperty Name="QueryStatus" Relationship="Model.FK_Queries_QueryStatus" FromRole="Queries" ToRole="QueryStatus" />
          <NavigationProperty Name="QueryType" Relationship="Model.FK_Queries_QueryTypes" FromRole="Queries" ToRole="QueryTypes" />
        </EntityType>
        <EntityType Name="QuerySource">
          <Key>
            <PropertyRef Name="QuerySourceID" />
          </Key>
          <Property Name="QuerySourceID" Type="Int16" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Description" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" />
          <Property Name="IsCancelled" Type="Boolean" Nullable="false" />
          <NavigationProperty Name="Queries" Relationship="Model.FK_Queries_QuerySources" FromRole="QuerySources" ToRole="Queries" />
        </EntityType>
        <EntityType Name="QueryStatus">
          <Key>
            <PropertyRef Name="QueryStatusID" />
          </Key>
          <Property Name="QueryStatusID" Type="Int16" Nullable="false" />
          <Property Name="Description" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" />
          <Property Name="IsCancelled" Type="Boolean" Nullable="false" />
          <NavigationProperty Name="Queries" Relationship="Model.FK_Queries_QueryStatus" FromRole="QueryStatus" ToRole="Queries" />
        </EntityType>
        <EntityType Name="QueryType">
          <Key>
            <PropertyRef Name="QueryTypeID" />
          </Key>
          <Property Name="QueryTypeID" Type="Int16" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Description" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" />
          <Property Name="DefaultAssignedToUserRoleID" Type="Int16" Nullable="false" />
          <Property Name="DefaultEscalatedToUserRoleID" Type="Int16" Nullable="false" />
          <Property Name="MessageTemplateID" Type="Int32" Nullable="false" />
          <Property Name="CustomPostScript" Type="String" MaxLength="Max" Unicode="false" FixedLength="false" />
          <Property Name="IsCancelled" Type="Boolean" Nullable="false" />
          <NavigationProperty Name="Queries" Relationship="Model.FK_Queries_QueryTypes" FromRole="QueryTypes" ToRole="Queries" />
        </EntityType>
        <Association Name="FK_Messages_MessageTypes">
          <End Role="MessageTypes" Type="Model.MessageType" Multiplicity="1" />
          <End Role="Messages" Type="Model.Message" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="MessageTypes">
              <PropertyRef Name="MessageTypeID" />
            </Principal>
            <Dependent Role="Messages">
              <PropertyRef Name="MessageTypeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Queries_QuerySources">
          <End Role="QuerySources" Type="Model.QuerySource" Multiplicity="1" />
          <End Role="Queries" Type="Model.Query" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="QuerySources">
              <PropertyRef Name="QuerySourceID" />
            </Principal>
            <Dependent Role="Queries">
              <PropertyRef Name="QuerySourceID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Queries_QueryStatus">
          <End Role="QueryStatus" Type="Model.QueryStatus" Multiplicity="1" />
          <End Role="Queries" Type="Model.Query" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="QueryStatus">
              <PropertyRef Name="QueryStatusID" />
            </Principal>
            <Dependent Role="Queries">
              <PropertyRef Name="QueryStatusID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Queries_QueryTypes">
          <End Role="QueryTypes" Type="Model.QueryType" Multiplicity="1" />
          <End Role="Queries" Type="Model.Query" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="QueryTypes">
              <PropertyRef Name="QueryTypeID" />
            </Principal>
            <Dependent Role="Queries">
              <PropertyRef Name="QueryTypeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <ComplexType Name="MessageTemplateSqlTest">
          <Property Type="Int64" Name="MessageTemplateSqlTesterID" Nullable="true" />
          <Property Type="String" Name="Recipients" Nullable="true" />
          <Property Type="String" Name="Subject" Nullable="true" MaxLength="1000" />
          <Property Type="String" Name="Message" Nullable="true" />
        </ComplexType>
        <ComplexType Name="Pr_MessageSearch_Result">
          <Property Type="Int64" Name="MessageID" Nullable="false" />
          <Property Type="Byte" Name="MessageTypeID" Nullable="false" />
          <Property Type="Int32" Name="EntityID" Nullable="true" />
          <Property Type="Int64" Name="ItemID" Nullable="true" />
          <Property Type="String" Name="Sender" Nullable="true" MaxLength="255" />
          <Property Type="String" Name="Recipients" Nullable="true" />
          <Property Type="String" Name="CC" Nullable="true" />
          <Property Type="String" Name="BCC" Nullable="true" />
          <Property Type="String" Name="Subject" Nullable="false" MaxLength="1000" />
          <Property Type="String" Name="Message1" Nullable="true" />
          <Property Type="Boolean" Name="IsHtml" Nullable="false" />
          <Property Type="DateTime" Name="SentDate" Nullable="true" Precision="23" />
          <Property Type="Int32" Name="Retries" Nullable="false" />
          <Property Type="Boolean" Name="IsCancelled" Nullable="false" />
          <Property Type="Int64" Name="CreatedByID" Nullable="false" />
          <Property Type="DateTime" Name="CreatedDate" Nullable="false" Precision="23" />
          <Property Type="Int64" Name="UpdatedByID" Nullable="false" />
          <Property Type="DateTime" Name="UpdatedDate" Nullable="false" Precision="23" />
          <Property Type="String" Name="KnownAs" Nullable="true" MaxLength="101" />
        </ComplexType>
      </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="ModelStoreContainer" CdmEntityContainer="AfxAdminCrmContext">
          <EntitySetMapping Name="Comments">
            <EntityTypeMapping TypeName="Model.Comment">
              <MappingFragment StoreEntitySet="Comments">
                <ScalarProperty Name="CommentID" ColumnName="CommentID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="Comment1" ColumnName="Comment" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="UpdatedByID" ColumnName="UpdatedByID" />
                <ScalarProperty Name="UpdatedDate" ColumnName="UpdatedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Messages">
            <EntityTypeMapping TypeName="Model.Message">
              <MappingFragment StoreEntitySet="Messages">
                <ScalarProperty Name="MessageID" ColumnName="MessageID" />
                <ScalarProperty Name="MessageTypeID" ColumnName="MessageTypeID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="Sender" ColumnName="Sender" />
                <ScalarProperty Name="Recipients" ColumnName="Recipients" />
                <ScalarProperty Name="CC" ColumnName="CC" />
                <ScalarProperty Name="BCC" ColumnName="BCC" />
                <ScalarProperty Name="Subject" ColumnName="Subject" />
                <ScalarProperty Name="Message1" ColumnName="Message" />
                <ScalarProperty Name="IsHtml" ColumnName="IsHtml" />
                <ScalarProperty Name="SentDate" ColumnName="SentDate" />
                <ScalarProperty Name="Retries" ColumnName="Retries" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="UpdatedByID" ColumnName="UpdatedByID" />
                <ScalarProperty Name="UpdatedDate" ColumnName="UpdatedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="MessageTemplates">
            <EntityTypeMapping TypeName="Model.MessageTemplate">
              <MappingFragment StoreEntitySet="MessageTemplates">
                <ScalarProperty Name="MessageTemplateID" ColumnName="MessageTemplateID" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Subject" ColumnName="Subject" />
                <ScalarProperty Name="Message" ColumnName="Message" />
                <ScalarProperty Name="RecipientSqlScript" ColumnName="RecipientSqlScript" />
                <ScalarProperty Name="DatasetSqlScript" ColumnName="DatasetSqlScript" />
                <ScalarProperty Name="IsSystemTemplate" ColumnName="IsSystemTemplate" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="MessageTypes">
            <EntityTypeMapping TypeName="Model.MessageType">
              <MappingFragment StoreEntitySet="MessageTypes">
                <ScalarProperty Name="MessageTypeID" ColumnName="MessageTypeID" />
                <ScalarProperty Name="Description" ColumnName="Description" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Queries">
            <EntityTypeMapping TypeName="Model.Query">
              <MappingFragment StoreEntitySet="Queries">
                <ScalarProperty Name="QueryID" ColumnName="QueryID" />
                <ScalarProperty Name="QueryReference" ColumnName="QueryReference" />
                <ScalarProperty Name="QueryTypeID" ColumnName="QueryTypeID" />
                <ScalarProperty Name="QueryStatusID" ColumnName="QueryStatusID" />
                <ScalarProperty Name="QuerySourceID" ColumnName="QuerySourceID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="AssignedToUserRoleID" ColumnName="AssignedToUserRoleID" />
                <ScalarProperty Name="AssignedToUserID" ColumnName="AssignedToUserID" />
                <ScalarProperty Name="AssignedToUserDate" ColumnName="AssignedToUserDate" />
                <ScalarProperty Name="CompletedByID" ColumnName="CompletedByID" />
                <ScalarProperty Name="CompletedDate" ColumnName="CompletedDate" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="ResponseEmailAddresses" ColumnName="ResponseEmailAddresses" />
                <ScalarProperty Name="ResponseContactNumbers" ColumnName="ResponseContactNumbers" />
                <ScalarProperty Name="LatestComment" ColumnName="LatestComment" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="UpdatedByID" ColumnName="UpdatedByID" />
                <ScalarProperty Name="UpdatedDate" ColumnName="UpdatedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="QuerySources">
            <EntityTypeMapping TypeName="Model.QuerySource">
              <MappingFragment StoreEntitySet="QuerySources">
                <ScalarProperty Name="QuerySourceID" ColumnName="QuerySourceID" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="QueryStatus">
            <EntityTypeMapping TypeName="Model.QueryStatus">
              <MappingFragment StoreEntitySet="QueryStatus">
                <ScalarProperty Name="QueryStatusID" ColumnName="QueryStatusID" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="QueryTypes">
            <EntityTypeMapping TypeName="Model.QueryType">
              <MappingFragment StoreEntitySet="QueryTypes">
                <ScalarProperty Name="QueryTypeID" ColumnName="QueryTypeID" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="DefaultAssignedToUserRoleID" ColumnName="DefaultAssignedToUserRoleID" />
                <ScalarProperty Name="DefaultEscalatedToUserRoleID" ColumnName="DefaultEscalatedToUserRoleID" />
                <ScalarProperty Name="MessageTemplateID" ColumnName="MessageTemplateID" />
                <ScalarProperty Name="CustomPostScript" ColumnName="CustomPostScript" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <FunctionImportMapping FunctionImportName="Pr_MessageTemplateSqlTester" FunctionName="Model.Store.Pr_MessageTemplateSqlTester">
            <ResultMapping>
              <ComplexTypeMapping TypeName="Model.MessageTemplateSqlTest">
                <ScalarProperty Name="MessageTemplateSqlTesterID" ColumnName="MessageTemplateSqlTesterID" />
                <ScalarProperty Name="Recipients" ColumnName="Recipients" />
                <ScalarProperty Name="Subject" ColumnName="Subject" />
                <ScalarProperty Name="Message" ColumnName="Message" />
              </ComplexTypeMapping>
            </ResultMapping>
          </FunctionImportMapping>
          <FunctionImportMapping FunctionImportName="Pr_MessageTemplateTester" FunctionName="Model.Store.Pr_MessageTemplateTester" />
          <FunctionImportMapping FunctionImportName="Pr_MessageSearch" FunctionName="Model.Store.Pr_MessageSearch" >
            <ResultMapping>
              <ComplexTypeMapping TypeName="Model.Pr_MessageSearch_Result">
                <ScalarProperty Name="MessageID" ColumnName="MessageID" />
                <ScalarProperty Name="MessageTypeID" ColumnName="MessageTypeID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="Sender" ColumnName="Sender" />
                <ScalarProperty Name="Recipients" ColumnName="Recipients" />
                <ScalarProperty Name="CC" ColumnName="CC" />
                <ScalarProperty Name="BCC" ColumnName="BCC" />
                <ScalarProperty Name="Subject" ColumnName="Subject" />
                <ScalarProperty Name="Message1" ColumnName="Message1" />
                <ScalarProperty Name="IsHtml" ColumnName="IsHtml" />
                <ScalarProperty Name="SentDate" ColumnName="SentDate" />
                <ScalarProperty Name="Retries" ColumnName="Retries" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="UpdatedByID" ColumnName="UpdatedByID" />
                <ScalarProperty Name="UpdatedDate" ColumnName="UpdatedDate" />
                <ScalarProperty Name="KnownAs" ColumnName="KnownAs" />
              </ComplexTypeMapping>
            </ResultMapping>
          </FunctionImportMapping>
        </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" />
      </DesignerInfoPropertySet>
    </Options>
    <!-- Diagram content (shape and connector positions) -->
    <Diagrams>
      <Diagram Name="CrmModel">
        <EntityTypeShape EntityType="Model.Comment" Width="1.5" PointX="10.375" PointY="2.625" Height="2.7494921874999996" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.Message" Width="2.125" PointX="7.25" PointY="0.5" Height="4.6725065104166665" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.MessageTemplate" Width="2" PointX="12.625" PointY="2.75" Height="2.5571907552083317" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.MessageType" Width="2.125" PointX="7.25" PointY="5.875" Height="1.5956835937499987" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.Query" Width="2.25" PointX="3.625" PointY="1.375" Height="5.4417122395833317" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.QuerySource" Width="2.25" PointX="0.5" PointY="3.125" Height="1.787985026041667" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.QueryStatus" Width="2.25" PointX="0.5" PointY="0.5" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="Model.QueryType" Width="2.25" PointX="0.5" PointY="6" Height="2.5571907552083317" IsExpanded="true" />
        <AssociationConnector Association="Model.FK_Messages_MessageTypes" ManuallyRouted="false">
          <ConnectorPoint PointX="8.3125" PointY="5.875" />
          <ConnectorPoint PointX="8.3125" PointY="5.1725065104166665" />
        </AssociationConnector>
        <AssociationConnector Association="Model.FK_Queries_QuerySources" ManuallyRouted="false">
          <ConnectorPoint PointX="2.75" PointY="4.0189925130208337" />
          <ConnectorPoint PointX="3.625" PointY="4.0189925130208337" />
        </AssociationConnector>
        <AssociationConnector Association="Model.FK_Queries_QueryStatus" ManuallyRouted="false">
          <ConnectorPoint PointX="2.75" PointY="1.8314925130208337" />
          <ConnectorPoint PointX="3.625" PointY="1.8314925130208337" />
        </AssociationConnector>
        <AssociationConnector Association="Model.FK_Queries_QueryTypes" ManuallyRouted="false">
          <ConnectorPoint PointX="2.75" PointY="6.4083561197916659" />
          <ConnectorPoint PointX="3.625" PointY="6.4083561197916659" />
        </AssociationConnector>
      </Diagram>
    </Diagrams>
  </Designer>
</edmx:Edmx>