fmwviormv / sqlite-net

Automatically exported from code.google.com/p/sqlite-net
0 stars 0 forks source link

Support for composite primary keys #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Regular primary keys are easy:

class Whatever {
    [PrimaryKey]
    int Id {get;set;}
    ...
}

However, it's legal (and often desirable) to have a primary key that consists 
of more than one column:

class Whatever {
    [PrimaryKey]
    int ForeignKey {get;set;}
    [PrimaryKey]
    int LocalKey {get;set;}
    ...
}

This currently throws an exception, but it would be nice if it automatically 
wrote the proper query:

    CREATE TABLE Whatever (
        ForeignKey int,
        LocalKey int,
        CONSTRAINT pk PRIMARY KEY (ForeignKey, LocalKey)
    )

Original issue reported on code.google.com by caron.m...@gmail.com on 5 Dec 2010 at 5:30