none
Another question about keys RRS feed

  • General discussion

  • As for the idea of giving my entities IDENTITY integer Entity Keys and then creating unique indexes on other fields--the documentation suggest you have to do this manually--which leads me to think that you need to re-add the "alternate" indexes every single time you re-generate the database DDL (i.e., Generate Database From Model). Is there a way to make the additions just once? Also, show me how to create a (non-entity-key) multi-field (unique) key/index. (i.e., If I have an identity-integer entity key on, say, the Person entity, what do I enter to create a unique index on the FirstName/LastName combination?)

    Robert Gustafson


    PS. Why isn't the 450-character limit for keys emphasized in the VS help? It's always tempting to think you can do anything that it doesn't say you can't.





    Friday, September 13, 2013 8:44 PM

All replies

  • Hi RobertGustafson,

    Sorry for being late.

    For “How to create a (non-entity-key) multi-field (unique) key/index. (i.e., If I have an identity-integer entity key on, say, the Person entity, what do I enter to create a unique index on the FirstName/LastName combination?)”, in my opinion, the index is not supported by default.

    To create index for entity framework we should to use T4 template and please see this link below:

    http://msdn.microsoft.com/en-us/data/ff830362.aspx

    Search for the section “Influencing the DDL Generation”, it shows how to create the index while the DDL is being created.

    >> Why isn't the 450-character limit emphasized in the VS help? It's always tempting to think you can do anything that it doesn't say you can't.

    I guess that we usually use an integer type value as a primary key and the integer value has not this problem.

    Thanks & Regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, September 16, 2013 10:52 AM
    Moderator
  • FIRST QUESTION NOT REALLY ANSWERED:

    How do I create a (non-entity-key) multi-field index for an entity? (Most examples I read are for single-fielders.) Also, do I have to re-create the index every time I update the model, or is there a way to do it just once? (Please give me an example here; I don't have time to experiment.)


    Robert Gustafson


    Wednesday, September 18, 2013 1:43 AM