WSO2 EI6.6 : Send email with attachment and HTML body - html-email

I am trying to send an email with attachment from WSO2EI6.6. The code is working as expected when I tried with some text as email body. When I tried to send HTML content, it is not working as expected. The HTML code is for a table and I am expecting to see the table in email body but the HTML code is displayed in email body as text.
Sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="EmailSend_SEQ" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<ns:text xmlns:ns="http://ws.apache.org/commons/ns/payload">$1</ns:text>
</format>
<args>
<arg evaluator="xml" expression="get-property('emailBodyWithRec')"/>
</args>
</payloadFactory>
<property value="Sample Email" name="Subject" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="messageType" scope="axis2" type="STRING" value="text/html"/>
<property name="ContentType" scope="default" type="STRING" value="text/html"/>
<property name="transport.mail.Format" scope="axis2" type="STRING" value="Attachment"/>
<property expression="get-property('sAttachmentFileName')" name="AttachmentFile" scope="axis2" type="STRING"/>
<header expression="fn:concat('mailto:', get-property('primaryEmail'))" name="To" scope="default"/>
<call/>
<property name="OUT_ONLY" scope="default" type="STRING" value="false"/>
<payloadFactory media-type="xml">
<format>
<EmailNotificationResponse>
<Status xmlns="">SUCCESS</Status>
</EmailNotificationResponse>
</format>
<args/>
</payloadFactory>
</sequence>
HTML Content :
<html xmlns="http://ws.apache.org/ns/synapse" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/><style>table, td, th { border: 1px solid black;}table { text-align: center; border-collapse: collapse; font-weight:bold}td { width: 140px;}</style></head>
<body>
<table>
<tr>
<th>Transactions Processed</th>
<td>1111110</td>
</tr>
<tr>
<th>Success</th>
<td>0</td>
</tr>
<tr>
<th>Expired</th>
<td>0</td>
</tr>
<tr>
<th>Failed</th>
<td>0</td>
</tr>
</table>
</body>
</html>

Related

ServiceFabric: failed to deploy new applications

I'm using service fabric on premisse with my micro services and I adopted the strategy of using dynamic ports, but apparently I think I've narrowed the range of ports because I've reached the limit of 25 applications with approximately 340 microservices in steless. and when trying to upload a new application it error in almost all services. if you remove an old one for example the application that was giving error goes up and stays stable. I have already increased the port range in clustermanifest in the parameter: ApplicationEndpoints but did not have effect ...
<ClusterManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="PmenosProducao" Version="0" Description="This is a generated file. Do not modify." xmlns="http://schemas.microsoft.com/2011/01/fabric">
<NodeTypes>
<NodeType Name="NodeType0">
<Endpoints>
<ClientConnectionEndpoint Port="19000" />
<LeaseDriverEndpoint Port="19002" />
<ClusterConnectionEndpoint Port="19001" />
<HttpGatewayEndpoint Port="19080" Protocol="http" />
<HttpApplicationGatewayEndpoint Port="19081" Protocol="http" />
<ServiceConnectionEndpoint Port="19003" />
<ApplicationEndpoints StartPort="20001" EndPort="45031" />
</Endpoints>
<PlacementProperties>
<Property Name="NodeTypeName" Value="NodeType0" />
</PlacementProperties>
</NodeType>
</NodeTypes>
<Infrastructure>
<WindowsServer>
<NodeList>
<Node NodeName="name" IPAddressOrFQDN="0.0.0.0" IsSeedNode="true" NodeTypeRef="NodeType0" FaultDomain="fd:/dc2/r0" UpgradeDomain="UD1" />
<Node NodeName="name" IPAddressOrFQDN="0.0.0.0" IsSeedNode="true" NodeTypeRef="NodeType0" FaultDomain="fd:/dc3/r0" UpgradeDomain="UD2" />
<Node NodeName="name" IPAddressOrFQDN="0.0.0.0" IsSeedNode="true" NodeTypeRef="NodeType0" FaultDomain="fd:/dc1/r0" UpgradeDomain="UD0" />
</NodeList>
</WindowsServer>
</Infrastructure>
<FabricSettings>
<Section Name="ApplicationGateway/Http">
<Parameter Name="DefaultHttpRequestTimeout" Value="600" />
<Parameter Name="IsEnabled" Value="true" />
</Section>
<Section Name="ClusterManager">
<Parameter Name="EnableAutomaticBaseline" Value="True" />
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="Common">
<Parameter Name="EnableEndpointV2" Value="True" />
</Section>
<Section Name="Diagnostics">
<Parameter Name="ClusterId" Value="bb99d580-50cc-4e1c-8a45-09f02f091f73" />
<Parameter Name="ConsumerInstances" Value="FileShareWinFabEtw, FileShareWinFabCrashDump, FileShareWinFabPerfCtr" />
<Parameter Name="EnableTelemetry" Value="False" />
<Parameter Name="MaxDiskQuotaInMB" Value="5120" />
<Parameter Name="ProducerInstances" Value="WinFabEtlFile, WinFabCrashDump, WinFabPerfCtrFolder" />
</Section>
<Section Name="FailoverManager">
<Parameter Name="ExpectedClusterSize" Value="3" />
<Parameter Name="IsSingletonReplicaMoveAllowedDuringUpgrade" Value="True" />
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="FaultAnalysisService">
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="Federation">
<Parameter Name="NodeIdGeneratorVersion" Value="V4" />
</Section>
<Section Name="FileShareWinFabCrashDump">
<Parameter Name="ConsumerType" Value="FileShareFolderUploader" />
<Parameter Name="DataDeletionAgeInDays" Value="7" />
<Parameter Name="IsEnabled" Value="true" />
<Parameter Name="ProducerInstance" Value="WinFabCrashDump" />
<Parameter Name="StoreConnectionString" Value="c:\ProgramData\SF\DiagnosticsStore\fabricdumps-bb99d580-50cc-4e1c-8a45-09f02f091f73" />
</Section>
<Section Name="FileShareWinFabEtw">
<Parameter Name="ConsumerType" Value="FileShareEtwCsvUploader" />
<Parameter Name="DataDeletionAgeInDays" Value="7" />
<Parameter Name="IsEnabled" Value="true" />
<Parameter Name="ProducerInstance" Value="WinFabEtlFile" />
<Parameter Name="StoreConnectionString" Value="c:\ProgramData\SF\DiagnosticsStore\fabriclogs-bb99d580-50cc-4e1c-8a45-09f02f091f73" />
</Section>
<Section Name="FileShareWinFabPerfCtr">
<Parameter Name="ConsumerType" Value="FileShareFolderUploader" />
<Parameter Name="DataDeletionAgeInDays" Value="7" />
<Parameter Name="IsEnabled" Value="true" />
<Parameter Name="ProducerInstance" Value="WinFabPerfCtrFolder" />
<Parameter Name="StoreConnectionString" Value="c:\ProgramData\SF\DiagnosticsStore\fabricperf-bb99d580-50cc-4e1c-8a45-09f02f091f73" />
</Section>
<Section Name="FileStoreService">
<Parameter Name="AnonymousAccessEnabled" Value="false" />
<Parameter Name="PrimaryAccountNTLMPasswordSecret" Value="8d9a2358-d8b7-4e55-8979-fbc3cde08551" />
<Parameter Name="PrimaryAccountType" Value="LocalUser" />
<Parameter Name="SecondaryAccountNTLMPasswordSecret" Value="bcac0708-43f8-4c86-875c-a26a939bdaa0" />
<Parameter Name="SecondaryAccountType" Value="LocalUser" />
</Section>
<Section Name="Hosting">
<Parameter Name="EndpointProviderEnabled" Value="true" />
<Parameter Name="FirewallPolicyEnabled" Value="true" />
<Parameter Name="RunAsPolicyEnabled" Value="true" />
</Section>
<Section Name="HttpGateway">
<Parameter Name="IsEnabled" Value="true" />
</Section>
<Section Name="ImageStoreService">
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="Management">
<Parameter Name="ImageStoreConnectionString" Value="fabric:ImageStore" />
</Section>
<Section Name="NamingService">
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="PlacementAndLoadBalancing">
<Parameter Name="QuorumBasedReplicaDistributionPerFaultDomains" Value="true" />
<Parameter Name="QuorumBasedReplicaDistributionPerUpgradeDomains" Value="true" />
</Section>
<Section Name="ReconfigurationAgent">
<Parameter Name="IsDeactivationInfoEnabled" Value="true" />
</Section>
<Section Name="Security">
<Parameter Name="AllowDefaultClient" Value="False" />
<Parameter Name="ClientRoleEnabled" Value="true" />
<Parameter Name="ClusterCredentialType" Value="None" />
<Parameter Name="DisableFirewallRuleForDomainProfile" Value="false" />
<Parameter Name="DisableFirewallRuleForPrivateProfile" Value="false" />
<Parameter Name="DisableFirewallRuleForPublicProfile" Value="false" />
<Parameter Name="ServerAuthCredentialType" Value="None" />
</Section>
<Section Name="Setup">
<Parameter Name="FabricDataRoot" Value="C:\ProgramData\SF" />
<Parameter Name="FabricLogRoot" Value="C:\ProgramData\SF\Log" />
</Section>
<Section Name="Trace/Etw">
<Parameter Name="Level" Value="4" />
</Section>
<Section Name="UpgradeOrchestrationService">
<Parameter Name="AutoupgradeEnabled" Value="False" />
<Parameter Name="AutoupgradeInstallEnabled" Value="False" />
<Parameter Name="ClusterId" Value="bb99d580-50cc-4e1c-8a45-09f02f091f73" />
<Parameter Name="GoalStateExpirationReminderInDays" Value="30" />
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="WinFabCrashDump">
<Parameter Name="DataDeletionAgeInDays" Value="7" />
<Parameter Name="FolderType" Value="WindowsFabricCrashDumps" />
<Parameter Name="IsEnabled" Value="true" />
<Parameter Name="ProducerType" Value="FolderProducer" />
</Section>
<Section Name="WinFabEtlFile">
<Parameter Name="DataDeletionAgeInDays" Value="7" />
<Parameter Name="IsEnabled" Value="true" />
<Parameter Name="ProducerType" Value="EtlFileProducer" />
</Section>
<Section Name="WinFabPerfCtrFolder">
<Parameter Name="DataDeletionAgeInDays" Value="7" />
<Parameter Name="FolderType" Value="WindowsFabricPerformanceCounters" />
<Parameter Name="IsEnabled" Value="true" />
<Parameter Name="ProducerType" Value="FolderProducer" />
</Section>
</FabricSettings>
</ClusterManifest>
I am not 100% sure whether the issue you have is about available ports but if it is - can you check this documentation section?
FROM DOCS:
ephemeralPorts override the dynamic ports used by the OS. Service Fabric uses a part of these ports as application ports, and the remaining are available for the OS. It also maps this range to the existing range present in the OS, so for all purposes, you can use the ranges given in the sample JSON files. Make sure that the difference between the start and the end ports is at least 255. You might run into conflicts if this difference is too low, because this range is shared with the OS. To see the configured dynamic port range, run netsh int ipv4 show dynamicport tcp.
applicationPorts are the ports that are used by the Service Fabric applications. The application port range should be large enough to cover the endpoint requirement of your applications. This range should be exclusive from the dynamic port range on the machine, that is, the ephemeralPorts range as set in the configuration. Service Fabric uses these ports whenever new ports are required and takes care of opening the firewall for these ports.
These settings are configured for each nodeType in the cluster configuration.
In the ClusterManifest.xml (based on ClusterManifestType XML Schema) these settings are represented by ApplicationEndpoints and EphemeralEndpoints elements within NodeType element.

Cluster details in the SF Explorer: Load Metric Information

On the Details page of the cluster, in the section Load Metric Information, I can see constantly changing values for Action column.
It is changing from Creation to CreationWithMove and back again for Count, PrimaryCount and ReplicaCount. For other entries it shows NoActionNeeded.
What does that mean? And can it cause timeouts on client-side connecting to the cluster?
My cluster manifest:
<NodeTypes>
<NodeType Name="NodeType0">
<Endpoints>
<ClientConnectionEndpoint Port="19000" />
<LeaseDriverEndpoint Port="19002" />
<ClusterConnectionEndpoint Port="19001" />
<HttpGatewayEndpoint Port="19080" Protocol="http" />
<ServiceConnectionEndpoint Port="19003" />
<ApplicationEndpoints StartPort="20001" EndPort="20031" />
<EphemeralEndpoints StartPort="20032" EndPort="20287" />
</Endpoints>
<PlacementProperties>
<Property Name="NodeTypeName" Value="NodeType0" />
</PlacementProperties>
</NodeType>
</NodeTypes>
<Infrastructure>
<WindowsServer>
<NodeList>
<Node NodeName="vm0" IPAddressOrFQDN="test.env.com" NodeTypeRef="NodeType0" FaultDomain="fd:/dc1/r0" UpgradeDomain="UD0" />
<Node NodeName="vm1" IPAddressOrFQDN="test.env.com" NodeTypeRef="NodeType0" FaultDomain="fd:/dc2/r0" UpgradeDomain="UD1" />
<Node NodeName="vm2" IPAddressOrFQDN="test.env.com" IsSeedNode="true" NodeTypeRef="NodeType0" FaultDomain="fd:/dc3/r0" UpgradeDomain="UD2" />
<Node NodeName="vm3" IPAddressOrFQDN="test.env.com" IsSeedNode="true" NodeTypeRef="NodeType0" FaultDomain="fd:/dc4/r0" UpgradeDomain="UD3" />
<Node NodeName="vm4" IPAddressOrFQDN="test.env.com" IsSeedNode="true" NodeTypeRef="NodeType0" FaultDomain="fd:/dc5/r0" UpgradeDomain="UD4" />
</NodeList>
</WindowsServer>
</Infrastructure>
<FabricSettings>
<Section Name="ClusterManager">
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="FailoverManager">
<Parameter Name="ExpectedClusterSize" Value="5" />
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="FaultAnalysisService">
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="Federation">
<Parameter Name="NodeIdGeneratorVersion" Value="V4" />
</Section>
<Section Name="Hosting">
<Parameter Name="EndpointProviderEnabled" Value="true" />
<Parameter Name="FirewallPolicyEnabled" Value="true" />
<Parameter Name="RunAsPolicyEnabled" Value="true" />
</Section>
<Section Name="HttpGateway">
<Parameter Name="IsEnabled" Value="true" />
</Section>
<Section Name="NamingService">
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
<Section Name="ReconfigurationAgent">
<Parameter Name="IsDeactivationInfoEnabled" Value="true" />
</Section>
<Section Name="Security">
<Parameter Name="ClientRoleEnabled" Value="true" />
<Parameter Name="ClusterCredentialType" Value="None" />
<Parameter Name="DisableFirewallRuleForDomainProfile" Value="true" />
<Parameter Name="DisableFirewallRuleForPrivateProfile" Value="true" />
<Parameter Name="DisableFirewallRuleForPublicProfile" Value="true" />
<Parameter Name="ServerAuthCredentialType" Value="None" />
</Section>
<Section Name="UpgradeOrchestrationService">
<Parameter Name="AutoupgradeEnabled" Value="True" />
<Parameter Name="ClusterId" Value="568fbf20-048e-43dc-828e-dd42df9c662f" />
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="PlacementConstraints" Value="NodeTypeName==NodeType0" />
<Parameter Name="TargetReplicaSetSize" Value="3" />
</Section>
</FabricSettings>
I encountered with the same behavior, and after a little trial and error, I found out that it happens with stateless applications (I’ve tested only 2 so far) that has instance count of -1.
When I set the instance count to any number in range 1..<number_of_nodes>
the Action value of Count, PrimaryCount and ReplicaCount metrics under Load Metric Information table in the Cluster DETAILS tab no longer changes every second to Creation and CreationWithMove, instead it stays NoActionNeeded.

entity framework - inheritance design

Using .Net 4 with EF 1.0: I have a table per type inheritance database structure and edmx (see diagram and cutdown edmx at the end of the post. The edmx is created through a code generator). I've just included one subtype for this post but there are many!
All of our entity framework queries are also dynamically generated. So at the moment when I try to retrieve a product (which may or may not be a book) I have the following ESQL query being generated.
SELECT VALUE [tb_product] FROM [tb_product] as [tb_product] WHERE (([tb_product].[Id] = #p0))
If the object I've requested is a book, the object I'm getting returned to me is of type 'tb_product'. I can't seem to cast or otherwise access the 'book' information from this tb_product object.
How can I modify the query, edmx or some other component so that when I query the base type I can also access all relevant subtype information without a second database trip. Can I?
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="MyModel.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/2006/04/edm/ssdl">
<EntityContainer Name="MyModelStoreContainer">
<EntitySet Name="tb_productBook" EntityType="MyModel.Store.tb_productBook" store:Type="Tables" Schema="dbo" />
<EntitySet Name="tb_product" EntityType="MyModel.Store.tb_product" store:Type="Tables" Schema="dbo" />
<AssociationSet Name="FK_IdProductBook_Product" Association="MyModel.Store.FK_IdProductBook_Product">
<End Role="tb_product" EntitySet="tb_product" />
<End Role="tb_productBook" EntitySet="tb_productBook" />
</AssociationSet>
</EntityContainer>
<EntityType Name="tb_productBook">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="int" Nullable="false" />
<Property Name="title" Type="varchar" Nullable="false" MaxLength="150" />
<Property Name="subtitle" Type="varchar" Nullable="false" MaxLength="150" />
<Property Name="length" Type="int" Nullable="false" />
<Property Name="productCoverTypeId" Type="int" Nullable="false" />
<Property Name="volumeEdition" Type="varchar" Nullable="false" MaxLength="15" />
<Property Name="publisherName" Type="varchar" Nullable="false" MaxLength="100" />
<Property Name="publishDate" Type="datetime" />
<Property Name="iSBNNumber" Type="varchar" Nullable="false" MaxLength="30" />
<Property Name="description" Type="varchar" Nullable="false" />
<Property Name="authorBio" Type="varchar" Nullable="false" />
<Property Name="audience" Type="varchar" Nullable="false" />
<Property Name="expireDate" Type="datetime" />
<Property Name="vendorId" Type="int" Nullable="false" />
<Property Name="productCommissionTypeId" Type="int" Nullable="false" />
<Property Name="commissionValue" Type="decimal" Nullable="false" Precision="9" Scale="2" />
<Property Name="languageId" Type="int" Nullable="false" />
<Property Name="countryId" Type="int" Nullable="false" />
<Property Name="stateId" Type="int" Nullable="false" />
<Property Name="inventoryLocation" Type="varchar" Nullable="false" MaxLength="2000" />
</EntityType>
<EntityType Name="tb_product">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="name" Type="varchar" MaxLength="100" />
<Property Name="productSku" Type="varchar" Nullable="false" MaxLength="17" />
<Property Name="productTypeId" Type="int" Nullable="false" />
<Property Name="price" Type="decimal" Nullable="false" Precision="9" Scale="2" />
<Property Name="marketOnWeb" Type="bit" Nullable="false" />
<Property Name="subsidiaryId" Type="int" Nullable="false" />
<Property Name="lmsProductId" Type="int" />
<Property Name="topicId" Type="int" />
<Property Name="categoryId" Type="int" />
<Property Name="eventId" Type="int" />
<Property Name="note" Type="varchar" />
<Property Name="expirationDate" Type="datetime" />
<Property Name="mediaLength" Type="int" />
<Property Name="urlSlug" Type="varchar" MaxLength="200" />
<Property Name="productSourceId" Type="int" />
<Property Name="created" Type="datetime" Nullable="false" />
<Property Name="createdBy" Type="varchar" Nullable="false" MaxLength="30" />
<Property Name="lastUpdated" Type="datetime" Nullable="false" />
<Property Name="lastUpdatedBy" Type="varchar" Nullable="false" MaxLength="30" />
</EntityType>
<Association Name="FK_IdProductBook_Product">
<End Role="tb_product" Type="MyModel.Store.tb_product" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="tb_productBook" Type="MyModel.Store.tb_productBook" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="tb_product">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="tb_productBook">
<PropertyRef Name="id" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="MyModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityContainer Name="MyEntities">
<EntitySet Name="tb_product" EntityType="MyModel.tb_product" />
</EntityContainer>
<EntityType Name="tb_productBook" BaseType="MyModel.tb_product">
<Property Name="title" Type="String" Nullable="false" />
<Property Name="subtitle" Type="String" Nullable="false" />
<Property Name="length" Type="Int32" Nullable="false" />
<Property Name="volumeEdition" Type="String" Nullable="false" />
<Property Name="publisherName" Type="String" Nullable="false" />
<Property Name="publishDate" Type="DateTime" Nullable="true" />
<Property Name="iSBNNumber" Type="String" Nullable="false" />
<Property Name="description" Type="String" Nullable="false" />
<Property Name="authorBio" Type="String" Nullable="false" />
<Property Name="audience" Type="String" Nullable="false" />
<Property Name="expireDate" Type="DateTime" Nullable="true" />
<Property Name="vendorId" Type="Int32" Nullable="false" />
<Property Name="commissionValue" Type="Decimal" Nullable="false" />
<Property Name="inventoryLocation" Type="String" Nullable="false" />
<NavigationProperty Name="ProductBook_Country" Relationship="MyModel.FK_CountryProductBook_Country" FromRole="tb_productBook" ToRole="tb_country" />
<NavigationProperty Name="ProductBook_Language" Relationship="MyModel.FK_LanguageProductBook_Language" FromRole="tb_productBook" ToRole="tb_language" />
<NavigationProperty Name="ProductBook_ProductCommissionType" Relationship="MyModel.FK_ProductCommissionTypeProductBook_ProductCommissionType" FromRole="tb_productBook" ToRole="tb_productCommissionType" />
<NavigationProperty Name="ProductBook_ProductCoverType" Relationship="MyModel.FK_ProductCoverTypeProductBook_ProductCoverType" FromRole="tb_productBook" ToRole="tb_productCoverType" />
<NavigationProperty Name="ProductBook_State" Relationship="MyModel.FK_StateProductBook_State" FromRole="tb_productBook" ToRole="tb_state" />
</EntityType>
<EntityType Name="tb_product">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="Int32" Nullable="false" />
<Property Name="name" Type="String" Nullable="true" />
<Property Name="productSku" Type="String" Nullable="false" />
<Property Name="price" Type="Decimal" Nullable="false" />
<Property Name="marketOnWeb" Type="Boolean" Nullable="false" />
<Property Name="subsidiaryId" Type="Int32" Nullable="false" />
<Property Name="lmsProductId" Type="Int32" Nullable="true" />
<Property Name="topicId" Type="Int32" Nullable="true" />
<Property Name="note" Type="String" Nullable="true" />
<Property Name="expirationDate" Type="DateTime" Nullable="true" />
<Property Name="mediaLength" Type="Int32" Nullable="true" />
<Property Name="urlSlug" Type="String" Nullable="true" />
<Property Name="created" Type="DateTime" Nullable="false" />
<Property Name="createdBy" Type="String" Nullable="false" />
<Property Name="lastUpdated" Type="DateTime" Nullable="false" />
<Property Name="lastUpdatedBy" Type="String" Nullable="false" />
<NavigationProperty Name="CampaignAdvertisedProduct_Product" Relationship="MyModel.FK_ProductCampaignAdvertisedProduct_Product" FromRole="tb_product" ToRole="tb_campaignAdvertisedProduct" />
<NavigationProperty Name="DiscountGroupProduct_Product" Relationship="MyModel.FK_ProductDiscountGroupProduct_Product" FromRole="tb_product" ToRole="tb_discountGroupProduct" />
<NavigationProperty Name="LogCampaignResponseUpdate_Product" Relationship="MyModel.FK_ProductLogCampaignResponseUpdate_Product" FromRole="tb_product" ToRole="tb_logCampaignResponseUpdate" />
<NavigationProperty Name="ProductAuthor_Product" Relationship="MyModel.FK_ProductProductAuthor_Product" FromRole="tb_product" ToRole="tb_productAuthor" />
<NavigationProperty Name="ProductImage_Product" Relationship="MyModel.FK_ProductProductImage_Product" FromRole="tb_product" ToRole="tb_productImage" />
<NavigationProperty Name="ProductMarketingContent_Product" Relationship="MyModel.FK_ProductProductMarketingContent_Product" FromRole="tb_product" ToRole="tb_productMarketingContent" />
<NavigationProperty Name="ProductOnsiteStaffAgency_Product" Relationship="MyModel.FK_ProductProductOnsiteStaffAgency_Product" FromRole="tb_product" ToRole="tb_productOnsiteStaffAgency" />
<NavigationProperty Name="ProductProblem_Product" Relationship="MyModel.FK_ProductProductProblem_Product" FromRole="tb_product" ToRole="tb_productProblem" />
<NavigationProperty Name="ProductVenue_Product" Relationship="MyModel.FK_ProductProductVenue_Product" FromRole="tb_product" ToRole="tb_productVenue" />
<NavigationProperty Name="VenueEmailRequest_Product" Relationship="MyModel.FK_ProductVenueEmailRequest_Product" FromRole="tb_product" ToRole="tb_venueEmailRequest" />
<NavigationProperty Name="Product_Category" Relationship="MyModel.FK_CategoryProduct_Category" FromRole="tb_product" ToRole="tb_category" />
<NavigationProperty Name="Product_ProductSource" Relationship="MyModel.FK_ProductSourceProduct_ProductSource" FromRole="tb_product" ToRole="tb_productSource" />
<NavigationProperty Name="Product_ProductType" Relationship="MyModel.FK_ProductTypeProduct_ProductType" FromRole="tb_product" ToRole="tb_productType" />
<NavigationProperty Name="Product_Event" Relationship="MyModel.FK_EventProduct_Event" FromRole="tb_product" ToRole="tb_event" />
<NavigationProperty Name="tb_category" Relationship="MyModel.tb_product_category" FromRole="tb_product" ToRole="tb_category" />
<NavigationProperty Name="tb_contact" Relationship="MyModel.tb_product_faculty" FromRole="tb_product" ToRole="tb_contact" />
<NavigationProperty Name="tb_state" Relationship="MyModel.tb_product_State" FromRole="tb_product" ToRole="tb_state" />
<NavigationProperty Name="tb_vendorCost" Relationship="MyModel.tb_product_VendorCost" FromRole="tb_product" ToRole="tb_vendorCost" />
<NavigationProperty Name="tb_vendorInvoice" Relationship="MyModel.tb_product_VendorInvoice" FromRole="tb_product" ToRole="tb_vendorInvoice" />
<NavigationProperty Name="tb_vendorPayment" Relationship="MyModel.tb_product_VendorPayment" FromRole="tb_product" ToRole="tb_vendorPayment" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
<EntityContainerMapping StorageEntityContainer="MyModelStoreContainer" CdmEntityContainer="MyEntities">
<EntitySetMapping Name="tb_product">
<EntityTypeMapping TypeName="IsTypeOf(MyModel.tb_product)">
<MappingFragment StoreEntitySet="tb_product">
<ScalarProperty Name="lastUpdatedBy" ColumnName="lastUpdatedBy" />
<ScalarProperty Name="lastUpdated" ColumnName="lastUpdated" />
<ScalarProperty Name="createdBy" ColumnName="createdBy" />
<ScalarProperty Name="created" ColumnName="created" />
<ScalarProperty Name="urlSlug" ColumnName="urlSlug" />
<ScalarProperty Name="mediaLength" ColumnName="mediaLength" />
<ScalarProperty Name="expirationDate" ColumnName="expirationDate" />
<ScalarProperty Name="note" ColumnName="note" />
<ScalarProperty Name="topicId" ColumnName="topicId" />
<ScalarProperty Name="lmsProductId" ColumnName="lmsProductId" />
<ScalarProperty Name="subsidiaryId" ColumnName="subsidiaryId" />
<ScalarProperty Name="marketOnWeb" ColumnName="marketOnWeb" />
<ScalarProperty Name="price" ColumnName="price" />
<ScalarProperty Name="productSku" ColumnName="productSku" />
<ScalarProperty Name="name" ColumnName="name" />
<ScalarProperty Name="id" ColumnName="id" />
</MappingFragment>
</EntityTypeMapping>
<EntityTypeMapping TypeName="IsTypeOf(MyModel.tb_productBook)">
<MappingFragment StoreEntitySet="tb_productBook">
<ScalarProperty Name="inventoryLocation" ColumnName="inventoryLocation" />
<ScalarProperty Name="commissionValue" ColumnName="commissionValue" />
<ScalarProperty Name="vendorId" ColumnName="vendorId" />
<ScalarProperty Name="expireDate" ColumnName="expireDate" />
<ScalarProperty Name="audience" ColumnName="audience" />
<ScalarProperty Name="authorBio" ColumnName="authorBio" />
<ScalarProperty Name="description" ColumnName="description" />
<ScalarProperty Name="iSBNNumber" ColumnName="iSBNNumber" />
<ScalarProperty Name="publishDate" ColumnName="publishDate" />
<ScalarProperty Name="publisherName" ColumnName="publisherName" />
<ScalarProperty Name="volumeEdition" ColumnName="volumeEdition" />
<ScalarProperty Name="length" ColumnName="length" />
<ScalarProperty Name="subtitle" ColumnName="subtitle" />
<ScalarProperty Name="title" ColumnName="title" />
<ScalarProperty Name="id" ColumnName="id" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>

Firebird .NET Provider 2.7.5: Value cannot be null. Parameter name: key

This worked with Firebird .NET Provider 2.6.5:
using (var context = new SetupContext())
{
_maxApplicationID = context.Application.Max(a => (int?)a.ID) ?? 0;
}
Table Mapping:
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="Model1.Store" Alias="Self" Provider="FirebirdSql.Data.FirebirdClient" ProviderManifestToken="2.5" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
<EntityContainer Name="Model1StoreContainer">
<EntitySet Name="APPLICATION" EntityType="Model1.Store.APPLICATION" store:Type="Tables" Schema="Firebird" />
</EntityContainer>
<EntityType Name="APPLICATION">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" Nullable="false" />
<Property Name="NAME" Type="varchar" Nullable="false" MaxLength="50" />
<Property Name="DISPLAY_TEXT" Type="varchar" MaxLength="255" />
<Property Name="ARGUMENTS" Type="varchar" MaxLength="255" />
<Property Name="PATH" Type="varchar" MaxLength="255" />
<Property Name="TYPE" Type="char" MaxLength="1" />
</EntityType>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="Model1" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="Entities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="Application" EntityType="Model1.Application" />
</EntityContainer>
<EntityType Name="Application">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Int32" Nullable="false" />
<Property Name="Name" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
<Property Name="DisplayText" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
<Property Name="Arguments" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
<Property Name="Path" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
<Property Name="Type" Type="String" MaxLength="1" Unicode="true" FixedLength="true" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="Model1StoreContainer" CdmEntityContainer="Entities">
<EntitySetMapping Name="Application"><EntityTypeMapping TypeName="Model1.Application"><MappingFragment StoreEntitySet="APPLICATION">
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Name" ColumnName="NAME" />
<ScalarProperty Name="DisplayText" ColumnName="DISPLAY_TEXT" />
<ScalarProperty Name="Arguments" ColumnName="ARGUMENTS" />
<ScalarProperty Name="Path" ColumnName="PATH" />
<ScalarProperty Name="Type" ColumnName="TYPE" />
</MappingFragment></EntityTypeMapping></EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
Now I have upgraded to version Firebird .NET Provider 2.7.5 and I'm getting an ArgumentNullException saying that "Value cannot be null. Parameter name: key".
Is this a changed behaviour in 2.7.5 or did somthing went wrong with the update. If this is a changed behaviour: How can I get the maximum value of a column?
If done as Mark Rotteveel suggested. This is the link to the ticket in the firebird bug database: http://tracker.firebirdsql.org/browse/DNET-429

Entity Framework Add Mapping to View

Our app. has a complex set of security rules.
I've implemented the rules in a SQL Statement, then translated it to Linq to SQL and the Entity Framework. the EF one was having some performance issues due to the nature of follow-up queries that have to take place on the data set, so I figured it would be best to just have the filtering done in SQL where I have maximum control over the statement that is executed, to ensure performance. I fit it in a View, thinking I'd let EF use that as a basis & continue the rest of the filtering there, but I am having trouble mapping the existing tables to the view.
As you can see on the screenshot, all three columns are identified as Entity Key. The problem is that I can't define a FK for a View, so EF doesn't know how the connections are to be made. When I try to manualy create them, EF complains I need to specify a connection to all three columns (for a single relation), which is not possible. I've also tried it from the other end, but no dice.
Here's the .edmx:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="VPModel.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/02/edm/ssdl">
<EntityContainer Name="VPModelStoreContainer">
<EntitySet Name="entity" EntityType="VPModel.Store.entity" store:Type="Tables" Schema="dbo" />
<EntitySet Name="entity_type" EntityType="VPModel.Store.entity_type" store:Type="Tables" Schema="dbo" />
<EntitySet Name="user" EntityType="VPModel.Store.user" store:Type="Tables" Schema="dbo" />
<EntitySet Name="vwEntitiesFilteredOnSecurity" EntityType="VPModel.Store.vwEntitiesFilteredOnSecurity" store:Type="Views" store:Schema="dbo" store:Name="vwEntitiesFilteredOnSecurity">
<DefiningQuery>SELECT
[vwEntitiesFilteredOnSecurity].[id] AS [id],
[vwEntitiesFilteredOnSecurity].[type_id] AS [type_id],
[vwEntitiesFilteredOnSecurity].[user_id] AS [user_id]
FROM [dbo].[vwEntitiesFilteredOnSecurity] AS [vwEntitiesFilteredOnSecurity]</DefiningQuery>
</EntitySet>
<AssociationSet Name="FK_entity_entity" Association="VPModel.Store.FK_entity_entity">
<End Role="entity" EntitySet="entity" />
<End Role="entity1" EntitySet="entity" />
</AssociationSet>
<AssociationSet Name="FK_entity_entity_type" Association="VPModel.Store.FK_entity_entity_type">
<End Role="entity_type" EntitySet="entity_type" />
<End Role="entity" EntitySet="entity" />
</AssociationSet>
<AssociationSet Name="FK_entity_user" Association="VPModel.Store.FK_entity_user">
<End Role="user" EntitySet="user" />
<End Role="entity" EntitySet="entity" />
</AssociationSet>
<AssociationSet Name="FK_user_user" Association="VPModel.Store.FK_user_user">
<End Role="user" EntitySet="user" />
<End Role="user1" EntitySet="user" />
</AssociationSet>
</EntityContainer>
<EntityType Name="entity">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="name" Type="varchar" Nullable="false" MaxLength="200" />
<Property Name="creator_id" Type="int" />
<Property Name="type_id" Type="int" Nullable="false" />
<Property Name="parent_id" Type="int" />
</EntityType>
<EntityType Name="entity_type">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="name" Type="varchar" Nullable="false" MaxLength="150" />
</EntityType>
<EntityType Name="user">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="name" Type="varchar" Nullable="false" MaxLength="250" />
</EntityType>
<!--Errors Found During Generation:
warning 6002: The table/view 'mi7demo.dbo.vwEntitiesFilteredOnSecurity' 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="vwEntitiesFilteredOnSecurity">
<Key>
<PropertyRef Name="id" />
<PropertyRef Name="type_id" />
<PropertyRef Name="user_id" />
</Key>
<Property Name="id" Type="int" Nullable="false" />
<Property Name="type_id" Type="int" Nullable="false" />
<Property Name="user_id" Type="int" Nullable="false" />
</EntityType>
<Association Name="FK_entity_entity">
<End Role="entity" Type="VPModel.Store.entity" Multiplicity="0..1" />
<End Role="entity1" Type="VPModel.Store.entity" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="entity">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="entity1">
<PropertyRef Name="parent_id" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_entity_entity_type">
<End Role="entity_type" Type="VPModel.Store.entity_type" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="entity" Type="VPModel.Store.entity" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="entity_type">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="entity">
<PropertyRef Name="type_id" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_entity_user">
<End Role="user" Type="VPModel.Store.user" Multiplicity="0..1" />
<End Role="entity" Type="VPModel.Store.entity" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="user">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="entity">
<PropertyRef Name="creator_id" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_user_user">
<End Role="user" Type="VPModel.Store.user" Multiplicity="1" />
<End Role="user1" Type="VPModel.Store.user" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="user">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="user1">
<PropertyRef Name="id" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="VPModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="VP" annotation:LazyLoadingEnabled="true">
<EntitySet Name="entity" EntityType="VPModel.entity" />
<EntitySet Name="entity_type" EntityType="VPModel.entity_type" />
<EntitySet Name="user" EntityType="VPModel.user" />
<EntitySet Name="vwEntitiesFilteredOnSecurity" EntityType="VPModel.vwEntitiesFilteredOnSecurity" />
<AssociationSet Name="FK_entity_entity" Association="VPModel.FK_entity_entity">
<End EntitySet="entity" Role="entity" />
<End EntitySet="entity" Role="entity1" />
</AssociationSet>
<AssociationSet Name="FK_entity_entity_type" Association="VPModel.FK_entity_entity_type">
<End Role="entity_type" EntitySet="entity_type" />
<End Role="entity" EntitySet="entity" />
</AssociationSet>
<AssociationSet Name="FK_entity_user" Association="VPModel.FK_entity_user">
<End Role="user" EntitySet="user" />
<End Role="entity" EntitySet="entity" />
</AssociationSet>
<AssociationSet Name="FK_user_user" Association="VPModel.FK_user_user">
<End Role="user" EntitySet="user" />
<End Role="user1" EntitySet="user" />
</AssociationSet>
</EntityContainer>
<EntityType Name="entity">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="name" Type="String" Nullable="false" MaxLength="200" Unicode="false" FixedLength="false" />
<Property Name="creator_id" Type="Int32" />
<Property Name="type_id" Type="Int32" Nullable="false" />
<Property Name="parent_id" Type="Int32" />
<NavigationProperty Name="entity1" Relationship="VPModel.FK_entity_entity" FromRole="entity" ToRole="entity1" />
<NavigationProperty Name="entity2" Relationship="VPModel.FK_entity_entity" FromRole="entity1" ToRole="entity" />
<NavigationProperty Name="entity_type" Relationship="VPModel.FK_entity_entity_type" FromRole="entity" ToRole="entity_type" />
<NavigationProperty Name="user" Relationship="VPModel.FK_entity_user" FromRole="entity" ToRole="user" />
</EntityType>
<EntityType Name="entity_type">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="name" Type="String" Nullable="false" MaxLength="150" Unicode="false" FixedLength="false" />
<NavigationProperty Name="entity" Relationship="VPModel.FK_entity_entity_type" FromRole="entity_type" ToRole="entity" />
</EntityType>
<EntityType Name="user">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="name" Type="String" Nullable="false" MaxLength="250" Unicode="false" FixedLength="false" />
<NavigationProperty Name="entity" Relationship="VPModel.FK_entity_user" FromRole="user" ToRole="entity" />
<NavigationProperty Name="user1" Relationship="VPModel.FK_user_user" FromRole="user" ToRole="user1" />
<NavigationProperty Name="user2" Relationship="VPModel.FK_user_user" FromRole="user1" ToRole="user" />
</EntityType>
<EntityType Name="vwEntitiesFilteredOnSecurity">
<Key>
<PropertyRef Name="id" />
<PropertyRef Name="type_id" />
<PropertyRef Name="user_id" />
</Key>
<Property Name="id" Type="Int32" Nullable="false" />
<Property Name="type_id" Type="Int32" Nullable="false" />
<Property Name="user_id" Type="Int32" Nullable="false" />
</EntityType>
<Association Name="FK_entity_entity">
<End Type="VPModel.entity" Multiplicity="0..1" Role="entity" />
<End Type="VPModel.entity" Multiplicity="*" Role="entity1" />
<ReferentialConstraint>
<Principal Role="entity">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="entity1">
<PropertyRef Name="parent_id" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_entity_entity_type">
<End Role="entity_type" Type="VPModel.entity_type" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="entity" Type="VPModel.entity" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="entity_type">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="entity">
<PropertyRef Name="type_id" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_entity_user">
<End Role="user" Type="VPModel.user" Multiplicity="0..1" />
<End Role="entity" Type="VPModel.entity" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="user">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="entity">
<PropertyRef Name="creator_id" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_user_user">
<End Role="user" Type="VPModel.user" Multiplicity="1" />
<End Role="user1" Type="VPModel.user" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="user">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="user1">
<PropertyRef Name="id" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="VPModelStoreContainer" CdmEntityContainer="VP">
<EntitySetMapping Name="entity"><EntityTypeMapping TypeName="VPModel.entity"><MappingFragment StoreEntitySet="entity">
<ScalarProperty Name="id" ColumnName="id" />
<ScalarProperty Name="name" ColumnName="name" />
<ScalarProperty Name="creator_id" ColumnName="creator_id" />
<ScalarProperty Name="type_id" ColumnName="type_id" />
<ScalarProperty Name="parent_id" ColumnName="parent_id" />
</MappingFragment></EntityTypeMapping></EntitySetMapping>
<EntitySetMapping Name="entity_type"><EntityTypeMapping TypeName="VPModel.entity_type"><MappingFragment StoreEntitySet="entity_type">
<ScalarProperty Name="id" ColumnName="id" />
<ScalarProperty Name="name" ColumnName="name" />
</MappingFragment></EntityTypeMapping></EntitySetMapping>
<EntitySetMapping Name="user"><EntityTypeMapping TypeName="VPModel.user"><MappingFragment StoreEntitySet="user">
<ScalarProperty Name="id" ColumnName="id" />
<ScalarProperty Name="name" ColumnName="name" />
</MappingFragment></EntityTypeMapping></EntitySetMapping>
<EntitySetMapping Name="vwEntitiesFilteredOnSecurity"><EntityTypeMapping TypeName="VPModel.vwEntitiesFilteredOnSecurity"><MappingFragment StoreEntitySet="vwEntitiesFilteredOnSecurity">
<ScalarProperty Name="id" ColumnName="id" />
<ScalarProperty Name="type_id" ColumnName="type_id" />
<ScalarProperty Name="user_id" ColumnName="user_id" />
</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/2008/10/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="False" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="True" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams>
<Diagram Name="ViewProblem">
<EntityTypeShape EntityType="VPModel.entity" Width="1.5" PointX="3" PointY="3.75" Height="2.7494921874999987" IsExpanded="true" />
<EntityTypeShape EntityType="VPModel.entity_type" Width="1.5" PointX="0.75" PointY="5.875" Height="1.5956835937499996" IsExpanded="true" />
<EntityTypeShape EntityType="VPModel.user" Width="1.5" PointX="0.75" PointY="0.75" Height="1.9802864583333331" IsExpanded="true" />
<EntityTypeShape EntityType="VPModel.vwEntitiesFilteredOnSecurity" Width="1.5" PointX="5.75" PointY="3.25" Height="1.5956835937499996" IsExpanded="true" />
<AssociationConnector ManuallyRouted="false" Association="VPModel.FK_entity_entity">
<ConnectorPoint PointX="3.5319230769230767" PointY="6.4994921874999987" />
<ConnectorPoint PointX="3.5319230769230767" PointY="6.7494921875" />
<ConnectorPoint PointX="3.9784615384615383" PointY="6.7494921875" />
<ConnectorPoint PointX="3.9784615384615383" PointY="6.4994921874999987" />
</AssociationConnector>
<AssociationConnector Association="VPModel.FK_entity_entity_type" ManuallyRouted="false">
<ConnectorPoint PointX="2.25" PointY="6.18724609375" />
<ConnectorPoint PointX="3" PointY="6.18724609375" />
</AssociationConnector>
<AssociationConnector Association="VPModel.FK_entity_user" ManuallyRouted="false">
<ConnectorPoint PointX="2.25" PointY="1.7401432291666663" />
<ConnectorPoint PointX="3.75" PointY="1.7401432291666663" />
<ConnectorPoint PointX="3.75" PointY="3.75" />
</AssociationConnector>
<AssociationConnector Association="VPModel.FK_user_user" ManuallyRouted="false">
<ConnectorPoint PointX="1.2819230769230767" PointY="2.7302864583333331" />
<ConnectorPoint PointX="1.2819230769230767" PointY="2.9802864583333331" />
<ConnectorPoint PointX="1.7284615384615383" PointY="2.9802864583333331" />
<ConnectorPoint PointX="1.7284615384615383" PointY="2.7302864583333331" />
</AssociationConnector>
</Diagram>
</Diagrams>
</Designer>
</edmx:Edmx>
In the vwEntitiesFilter just click the field id, right click properties and in the properties window set "Entity Key" = false
Then in toolbox, chose association and associate user.id field with vwEntitiesFilter.user_id and entity.id with vwEntitiesFilter.entity_id.
This just allow you to make the relations