none
EntityType '[entitytype]' has no key defined.

    Question

  • Working with the Entity Framework.

     

    Error:

    EntityType 'yada' has no key defined. Define the Key for this Entity Type.

     

    Question is how do this in the desinger -or- how do I extract the (CSDL, SSDL, MSL ) files after I've already generated the framwork using th desinger so io can add it directly to the XML?

    Wednesday, September 10, 2008 6:10 PM

Answers

  • In the designer, just select the properties you need to be the EntityKey, and in the Properties panel just set Enity Key to true. You have to select each property that is part of the EntityKey one at a time and individually set each one. If you preferr to edit the xml directly, just close the visual designer, right-click the .edmx file, and open it with the xml editor. The key is defined in the EntityType element's Key child element:

     

    Code Snippet

    <EntityType Name="DealerProducts">

    <Key>

    <PropertyRef Name="DealerProductID" />

    </Key>

     

     

    Wednesday, September 10, 2008 7:59 PM