﻿<?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" 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="Messages">
          <Key>
            <PropertyRef Name="MessageID" />
          </Key>
          <Property Name="MessageID" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
          <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" MaxLength="1000" Nullable="false" />
          <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="Documents">
          <Key>
            <PropertyRef Name="DocumentID" />
          </Key>
          <Property Name="DocumentID" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="DocumentTypeID" Type="smallint" Nullable="false" />
          <Property Name="DocumentStoreLocationID" Type="bigint" Nullable="false" />
          <Property Name="EntityID" Type="int" Nullable="false" />
          <Property Name="ItemID" Type="bigint" Nullable="false" />
          <Property Name="Title" Type="varchar" MaxLength="255" />
          <Property Name="Description" Type="varchar" MaxLength="255" />
          <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" />
          <Property Name="DocumentMimeTypeID" Type="smallint" Nullable="false" />
        </EntityType>
        <EntityType Name="DocumentStore">
          <Key>
            <PropertyRef Name="DocumentStoreID" />
          </Key>
          <Property Name="DocumentStoreID" Type="bigint" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="DocumentID" Type="bigint" Nullable="false" />
          <Property Name="Version" Type="smallint" Nullable="false" />
          <Property Name="ContentBLOB" Type="image" Nullable="false" />
          <Property Name="MimeType" Type="varchar" MaxLength="100" Nullable="false" />
          <Property Name="Size" Type="bigint" Nullable="false" />
          <Property Name="Name" Type="varchar" MaxLength="255" Nullable="false" />
          <Property Name="Ext" Type="varchar" MaxLength="5" Nullable="false" />
        </EntityType>
        <EntityType Name="MailSettings">
          <Key>
            <PropertyRef Name="MailSettingID" />
          </Key>
          <Property Name="MailSettingID" Type="tinyint" Nullable="false" />
          <Property Name="Host" Type="varchar" MaxLength="50" Nullable="false" />
          <Property Name="Port" Type="int" Nullable="false" />
          <Property Name="UseDefaultCredentials" Type="bit" Nullable="false" />
          <Property Name="UserName" Type="varchar" MaxLength="50" />
          <Property Name="Password" Type="varchar" MaxLength="150" />
          <Property Name="Domain" Type="varchar" MaxLength="50" />
          <Property Name="EnableSSL" Type="bit" Nullable="false" />
        </EntityType>
        <EntityType Name="SmsSettings">
          <Key>
            <PropertyRef Name="SmsSettingID" />
          </Key>
          <Property Name="SmsSettingID" Type="tinyint" Nullable="false" />
          <Property Name="SmsDeliveryMethodID" Type="smallint" Nullable="false" />
          <Property Name="UserName" Type="varchar" MaxLength="50" />
          <Property Name="Password" Type="varchar" MaxLength="50" />
          <Property Name="UserRef" Type="varchar" MaxLength="50" />
        </EntityType>
        <Association Name="FK_DocumeStore_Documents">
          <End Role="Documents" Type="Self.Documents" Multiplicity="1" />
          <End Role="DocumentStore" Type="Self.DocumentStore" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Documents">
              <PropertyRef Name="DocumentID" />
            </Principal>
            <Dependent Role="DocumentStore">
              <PropertyRef Name="DocumentID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Function Name="Pr_MessageCreateTemplatedEmails" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="Crm">
          <Parameter Name="MessageTemplateID" Type="int" Mode="In" />
        </Function>
        <EntityContainer Name="ModelStoreContainer">
          <EntitySet Name="Messages" EntityType="Self.Messages" Schema="Crm" store:Type="Tables" />
          <EntitySet Name="Documents" EntityType="Self.Documents" Schema="Doc" store:Type="Tables" />
          <EntitySet Name="DocumentStore" EntityType="Self.DocumentStore" Schema="Doc" store:Type="Tables" />
          <EntitySet Name="MailSettings" EntityType="Self.MailSettings" Schema="System" store:Type="Tables" />
          <EntitySet Name="SmsSettings" EntityType="Self.SmsSettings" Schema="System" store:Type="Tables" />
          <AssociationSet Name="FK_DocumeStore_Documents" Association="Self.FK_DocumeStore_Documents">
            <End Role="Documents" EntitySet="Documents" />
            <End Role="DocumentStore" EntitySet="DocumentStore" />
          </AssociationSet>
        </EntityContainer>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="Messages" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
        <EntityContainer Name="MessageContext" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="Messages" EntityType="Messages.Message" />
          <EntitySet Name="Documents" EntityType="Messages.Document" />
          <EntitySet Name="DocumentContents" EntityType="Messages.DocumentContent" />
          <AssociationSet Name="FK_DocumeStore_Documents" Association="Messages.FK_DocumeStore_Documents">
            <End Role="Attachment" EntitySet="Documents" />
            <End Role="DocumentStore" EntitySet="DocumentContents" />
          </AssociationSet>
          <EntitySet Name="MailSettings" EntityType="Messages.MailSetting" />
          <EntitySet Name="SmsSettings" EntityType="Messages.SmsSetting" />
          <FunctionImport Name="Pr_MessageCreateTemplatedEmails">
          <Parameter Name="MessageTemplateID" Mode="In" Type="Int32" />
          </FunctionImport>
        </EntityContainer>
        <EntityType Name="Message">
          <Key>
            <PropertyRef Name="MessageID" />
          </Key>
          <Property Type="Int64" Name="MessageID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Type="Byte" Name="MessageTypeID" Nullable="false" />
          <Property Type="Int32" Name="EntityID" />
          <Property Type="Int64" Name="ItemID" />
          <Property Type="String" Name="Sender" MaxLength="255" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="Recipients" MaxLength="Max" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="CC" MaxLength="Max" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="BCC" MaxLength="Max" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="Subject" Nullable="false" MaxLength="1000" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="MessageText" MaxLength="Max" FixedLength="false" Unicode="false" />
          <Property Type="Boolean" Name="IsHtml" Nullable="false" />
          <Property Type="DateTime" Name="SentDate" Precision="3" />
          <Property Type="Boolean" Name="IsCancelled" Nullable="false" />
          <Property Type="Int64" Name="CreatedByID" Nullable="false" />
          <Property Type="DateTime" Name="CreatedDate" Nullable="false" Precision="3" />
          <Property Type="Int64" Name="UpdatedByID" Nullable="false" />
          <Property Type="DateTime" Name="UpdatedDate" Nullable="false" Precision="3" />
          <Property Type="Int32" Name="Retries" Nullable="false" />
        </EntityType>
        <EntityType Name="Document">
          <Key>
            <PropertyRef Name="DocumentID" />
          </Key>
          <Property Type="Int64" Name="DocumentID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Type="Int32" Name="EntityID" Nullable="false" />
          <Property Type="Int64" Name="ItemID" Nullable="false" />
          <Property Type="String" Name="Description" MaxLength="255" FixedLength="false" Unicode="false" />
          <Property Type="Boolean" Name="IsCancelled" Nullable="false" />
          <Property Type="Int64" Name="CreatedByID" Nullable="false" />
          <Property Type="DateTime" Name="CreatedDate" Nullable="false" Precision="3" />
          <Property Type="Int64" Name="UpdatedByID" Nullable="false" />
          <Property Type="DateTime" Name="UpdatedDate" Nullable="false" Precision="3" />
          <Property Type="Int16" Name="DocumentMimeTypeID" Nullable="false" />
          <NavigationProperty Name="DocumentContents" Relationship="Messages.FK_DocumeStore_Documents" FromRole="Attachment" ToRole="DocumentStore" />
          <Property Type="Int64" Name="DocumentStoreLocationID" Nullable="false" />
          <Property Type="Int16" Name="DocumentTypeID" Nullable="false" />
          <Property Name="Title" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
        </EntityType>
        <EntityType Name="DocumentContent">
          <Key>
            <PropertyRef Name="DocumentStoreID" />
          </Key>
          <Property Type="Int64" Name="DocumentStoreID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Type="Int64" Name="DocumentID" Nullable="false" />
          <Property Type="Int16" Name="Version" Nullable="false" />
          <Property Type="Binary" Name="ContentBLOB" Nullable="false" MaxLength="Max" FixedLength="false" />
          <Property Type="String" Name="MimeType" Nullable="false" MaxLength="100" FixedLength="false" Unicode="false" />
          <Property Type="Int64" Name="Size" Nullable="false" />
          <Property Type="String" Name="Name" Nullable="false" MaxLength="255" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="Ext" Nullable="false" MaxLength="5" FixedLength="false" Unicode="false" />
          <NavigationProperty Name="Document" Relationship="Messages.FK_DocumeStore_Documents" FromRole="DocumentStore" ToRole="Attachment" />
        </EntityType>
        <Association Name="FK_DocumeStore_Documents">
          <End Type="Messages.Document" Role="Attachment" Multiplicity="1" />
          <End Type="Messages.DocumentContent" Role="DocumentStore" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Attachment">
              <PropertyRef Name="DocumentID" />
            </Principal>
            <Dependent Role="DocumentStore">
              <PropertyRef Name="DocumentID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <EntityType Name="MailSetting">
          <Key>
            <PropertyRef Name="MailSettingID" />
          </Key>
          <Property Type="Byte" Name="MailSettingID" Nullable="false" />
          <Property Type="String" Name="Host" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Type="Int32" Name="Port" Nullable="false" />
          <Property Type="Boolean" Name="UseDefaultCredentials" Nullable="false" />
          <Property Type="String" Name="UserName" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="Password" MaxLength="150" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="Domain" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Type="Boolean" Name="EnableSSL" Nullable="false" />
        </EntityType>
        <EntityType Name="SmsSetting">
          <Key>
            <PropertyRef Name="SmsSettingID" />
          </Key>
          <Property Type="Byte" Name="SmsSettingID" Nullable="false" />
          <Property Type="Int16" Name="SmsDeliveryMethodID" Nullable="false" />
          <Property Type="String" Name="UserName" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="Password" MaxLength="50" FixedLength="false" Unicode="false" />
          <Property Type="String" Name="UserRef" MaxLength="50" FixedLength="false" Unicode="false" />
        </EntityType>
      </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="MessageContext">
          <EntitySetMapping Name="Messages">
            <EntityTypeMapping TypeName="Messages.Message">
              <MappingFragment StoreEntitySet="Messages">
                <ScalarProperty Name="Retries" ColumnName="Retries" />
                <ScalarProperty Name="UpdatedDate" ColumnName="UpdatedDate" />
                <ScalarProperty Name="UpdatedByID" ColumnName="UpdatedByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
                <ScalarProperty Name="SentDate" ColumnName="SentDate" />
                <ScalarProperty Name="IsHtml" ColumnName="IsHtml" />
                <ScalarProperty Name="MessageText" ColumnName="Message" />
                <ScalarProperty Name="Subject" ColumnName="Subject" />
                <ScalarProperty Name="BCC" ColumnName="BCC" />
                <ScalarProperty Name="CC" ColumnName="CC" />
                <ScalarProperty Name="Recipients" ColumnName="Recipients" />
                <ScalarProperty Name="Sender" ColumnName="Sender" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="MessageTypeID" ColumnName="MessageTypeID" />
                <ScalarProperty Name="MessageID" ColumnName="MessageID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Documents">
            <EntityTypeMapping TypeName="Messages.Document">
              <MappingFragment StoreEntitySet="Documents">
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="DocumentTypeID" ColumnName="DocumentTypeID" />
                <ScalarProperty Name="DocumentStoreLocationID" ColumnName="DocumentStoreLocationID" />
                <ScalarProperty Name="DocumentMimeTypeID" ColumnName="DocumentMimeTypeID" />
                <ScalarProperty Name="UpdatedDate" ColumnName="UpdatedDate" />
                <ScalarProperty Name="UpdatedByID" ColumnName="UpdatedByID" />
                <ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
                <ScalarProperty Name="CreatedByID" ColumnName="CreatedByID" />
                <ScalarProperty Name="IsCancelled" ColumnName="IsCancelled" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="ItemID" ColumnName="ItemID" />
                <ScalarProperty Name="EntityID" ColumnName="EntityID" />
                <ScalarProperty Name="DocumentID" ColumnName="DocumentID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="DocumentContents">
            <EntityTypeMapping TypeName="Messages.DocumentContent">
              <MappingFragment StoreEntitySet="DocumentStore">
                <ScalarProperty Name="Ext" ColumnName="Ext" />
                <ScalarProperty Name="Name" ColumnName="Name" />
                <ScalarProperty Name="Size" ColumnName="Size" />
                <ScalarProperty Name="MimeType" ColumnName="MimeType" />
                <ScalarProperty Name="ContentBLOB" ColumnName="ContentBLOB" />
                <ScalarProperty Name="Version" ColumnName="Version" />
                <ScalarProperty Name="DocumentID" ColumnName="DocumentID" />
                <ScalarProperty Name="DocumentStoreID" ColumnName="DocumentStoreID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="MailSettings">
            <EntityTypeMapping TypeName="Messages.MailSetting">
              <MappingFragment StoreEntitySet="MailSettings">
                <ScalarProperty Name="EnableSSL" ColumnName="EnableSSL" />
                <ScalarProperty Name="Domain" ColumnName="Domain" />
                <ScalarProperty Name="Password" ColumnName="Password" />
                <ScalarProperty Name="UserName" ColumnName="UserName" />
                <ScalarProperty Name="UseDefaultCredentials" ColumnName="UseDefaultCredentials" />
                <ScalarProperty Name="Port" ColumnName="Port" />
                <ScalarProperty Name="Host" ColumnName="Host" />
                <ScalarProperty Name="MailSettingID" ColumnName="MailSettingID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="SmsSettings">
            <EntityTypeMapping TypeName="Messages.SmsSetting">
              <MappingFragment StoreEntitySet="SmsSettings">
                <ScalarProperty Name="UserRef" ColumnName="UserRef" />
                <ScalarProperty Name="Password" ColumnName="Password" />
                <ScalarProperty Name="UserName" ColumnName="UserName" />
                <ScalarProperty Name="SmsDeliveryMethodID" ColumnName="SmsDeliveryMethodID" />
                <ScalarProperty Name="SmsSettingID" ColumnName="SmsSettingID" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <FunctionImportMapping FunctionImportName="Pr_MessageCreateTemplatedEmails" FunctionName="Model.Store.Pr_MessageCreateTemplatedEmails" />
        </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="CrmModel" ZoomLevel="82">
        <EntityTypeShape EntityType="Messages.Message" Width="1.5" PointX="0.5" PointY="0.5" Height="4.480205078125" />
        <EntityTypeShape EntityType="Messages.Document" Width="2.125" PointX="2.625" PointY="0.5" Height="3.3263964843749996" />
        <EntityTypeShape EntityType="Messages.DocumentContent" Width="1.75" PointX="5.5" PointY="0.5" Height="2.7494921874999996" />
        <AssociationConnector Association="Messages.FK_DocumeStore_Documents" >
          <ConnectorPoint PointX="4.75" PointY="1.8747460937499998" />
          <ConnectorPoint PointX="5.5" PointY="1.8747460937499998" />
        </AssociationConnector>
        <EntityTypeShape EntityType="Messages.MailSetting" Width="1.875" PointX="7.875" PointY="0.5" Height="2.5571907552083317" />
        <EntityTypeShape EntityType="Messages.SmsSetting" Width="1.875" PointX="7.875" PointY="3.625" Height="2.1725878906249996" />
      </Diagram>
    </Diagrams>
  </Designer>
</edmx:Edmx>