locked
How to Programmatically Find the PrimaryKey Of An Entity? RRS feed

  • Question

  • Hello !

    Is it possible to find, programmatically, which property is the primary key of an entity?

    Best regards,


    Ciro

    Thursday, March 5, 2015 12:00 PM

Answers

  • Good old silverlight will shine as gold with that code :)

    paul van bladel ==independent enterprise application architect== http://blog.pragmaswitch.com

    • Marked as answer by Oric.CQ Friday, March 6, 2015 10:07 AM
    Thursday, March 5, 2015 8:47 PM

All replies

  • check:

    entity.Details.GetModel().KeyProperties


    paul van bladel ==independent enterprise application architect== http://blog.pragmaswitch.com

    • Proposed as answer by ADefwebserver Thursday, March 5, 2015 8:20 PM
    Thursday, March 5, 2015 3:15 PM
  • Hello, Paul !

    Thank you to reply.

    "KeyProperties" is not showed as a method or property for GetModels(). Please, see the image bellow:

    Best regards,

    Ciro.


    Ciro

    Thursday, March 5, 2015 6:55 PM
  • you are not on an entity but on a entity collection.

    check this article where I use the above:

    http://blog.pragmaswitch.com/?p=291


    paul van bladel ==independent enterprise application architect== http://blog.pragmaswitch.com

    Thursday, March 5, 2015 7:07 PM
  • Paul,

    I need to call this property (KeyProperties) from the Silverlight Client (I could reproduce your code in a server).

    Is it possible?

    Best regards,


    Ciro

    Thursday, March 5, 2015 8:14 PM
  • Good old silverlight will shine as gold with that code :)

    paul van bladel ==independent enterprise application architect== http://blog.pragmaswitch.com

    • Marked as answer by Oric.CQ Friday, March 6, 2015 10:07 AM
    Thursday, March 5, 2015 8:47 PM
  • Thank you, Paul !

    Best regards,


    Ciro

    Friday, March 6, 2015 10:07 AM
  • Pleasure to help.

    paul van bladel ==independent enterprise application architect== http://blog.pragmaswitch.com

    Friday, March 6, 2015 10:18 AM