There exists a group of sights (a number of) that we are attempting to implement within the Entity Framework using their associations. These sights have primary secrets defined but for whatever reason after i create an Entity model on their behalf I received the content:

The table/view 'vwFoo' doesn't have a primary key defined. The important thing continues to be deduced and also the definition was produced like a read-only table/view.

Besides which makes them read-only, which we do not want, the associations aren't being maintained. Can there be any method of getting those to load in to the model properly?

The after sales database is SQL Server 2005 but we should also support 2000.

Any help could be appreciated,

UPDATE &lifier SOLUTION

Here's an XSLT transform that labored effectively to show two Sights from your EDMX into tables. It's two issues: 1) adding bad xmlns="" characteristics, and a pair of) not properly setting UTF-8 encoding. I fixed these two inside a separate Perl script.

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
                xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator"
                xmlns:ssdl="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"
                xmlns:edm="http://schemas.microsoft.com/ado/2006/04/edm"
                xmlns:cs="urn:schemas-microsoft-com:windows:storage:mapping:CS"
                exclude-result-prefixes="ssdl edm store cs" version="1.0">
    <xsl:output method="xml"/>

    <!-- Copy any nodes that aren't specifically transformed -->
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>

    <!-- Transform vwPerson -->
    <xsl:template match="edmx:Edmx/edmx:Runtime/edmx:StorageModels/ssdl:Schema/ssdl:EntityType[@Name='vwPerson']/ssdl:Key">
        <Key>
            <PropertyRef Name="fkPersonID" />
        </Key>
    </xsl:template>

    <xsl:template match="edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/edm:Schema/edm:EntityType[@Name='vwPerson']/edm:Key">
        <Key>
            <PropertyRef Name="fkPersonID" />
        </Key>
    </xsl:template>

    <xsl:template match="edmx:Edmx/edmx:Runtime/edmx:StorageModels/ssdl:Schema/ssdl:EntityContainer/ssdl:EntitySet[@Name='vwPerson']">
        <EntitySet Name="vwPerson"
                   EntityType="DataMachineModel.Store.vwPerson"  
                   store:Type="Tables" 
                   Schema="dbo" />
    </xsl:template>

    <!-- Transform vwPersonAddress -->
    <xsl:template match="edmx:Edmx/edmx:Runtime/edmx:StorageModels/ssdl:Schema/ssdl:EntityType[@Name='vwPersonAddress']/ssdl:Key">
        <Key>
            <PropertyRef Name="PersonID" />
        </Key>
    </xsl:template>

    <xsl:template match="edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/edm:Schema/edm:EntityType[@Name='vwPersonAddress']/edm:Key">
        <Key>
            <PropertyRef Name="PersonID" />
        </Key>
    </xsl:template>

    <xsl:template match="edmx:Edmx/edmx:Runtime/edmx:StorageModels/ssdl:Schema/ssdl:EntityContainer/ssdl:EntitySet[@Name='vwPersonAddress']">
        <EntitySet Name="vwPersonAddress"
                   EntityType="DataMachineModel.Store.vwPersonAddress"  
                   store:Type="Tables" 
                   Schema="dbo" />
    </xsl:template>

</xsl:stylesheet>

This may appear to operate to date as making the sights function like tables nevertheless it does not preserve associations together. I attempted adding the FK associations within the EDMX through the XSLT but didn't have success.

We have made the decision to create real tables from your sights and migrate the vista logic right into a separate class that may perform the blocking from the data we want.

Yes, the EF designer can't derive the PK of the view, so you have to help it out.