Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel 5 posts 54 karma points
    Sep 19, 2014 @ 14:16
    Daniel
    0

    Combined primary keys with petapoco

    Hello,

    Is it possible to create combined primary keys with PetaPoco?

     [TableName("slVisitors")]
       [PrimaryKey("EventId,MemberId", autoIncrement=false)]
       [ExplicitColumns]
       [DataContract(Name = "visitor", Namespace = "")]
       public class Visitor
       {    
    
           [Column("EventId")]
           [PrimaryKeyColumn(AutoIncrement = false, Clustered = true)]
           [DataMember(Name = "eventid")]
           public int EventId { getset; }
    
           [Column("MemberId")]
           [PrimaryKeyColumn(AutoIncrement = false, Clustered = true)]
           [DataMember(Name = "memberid")]
           public int MemberId { getset; }
       }

    This only creates a primary key for the first column. Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft