Re: [sqlite] Primary Key without DataAnnotation for Windows Runtime

2014-04-01 Thread Joe Mistachkin

Benedikt Neuhold wrote:
>
> we are building an App for Windows 8 and want to use sqlite as local DB.
We
> want to separate our Models from our DB Engine. So we need a way to set
the
> Primary Key without DataAnnotation. Is there a way? 
> 

I'm trying to figure out if I'm understanding your question correctly.  For
now,
I'll assume you can modify the CREATE TABLE statement itself.  In that case,
you
can make use of the PRIMARY KEY clause on one of the column definitions,
such as:

CREATE TABLE t1(x TEXT PRIMARY KEY, y TEXT);

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Primary Key without DataAnnotation for Windows Runtime

2014-04-01 Thread Doug McDonald
We achieved something similar by doing the following:

Creating a seperate assembly for our entities
Define the primary key attribute in that assembly, but inside the SQLite
namespace.
Comment out the primary key attribute in the SQLite/net project to avoid
re-defining it.
We were then able to share this assembly between projects, without being
tied to SQLite explicitely, but when we include SQLite in a project, the
primary key attribute is included.

Maybe that's of some use as to an approach.


On Mon, Mar 31, 2014 at 3:52 PM, Benedikt Neuhold wrote:

> Hi,
>
>
>
> we are building an App for Windows 8 and want to use sqlite as local DB. We
> want to separate our Models from our DB Engine. So we need a way to set the
> Primary Key without DataAnnotation. Is there a way?
>
>
>
> Thanks a lot!
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Doug McDonald

BSc(Hons) | MCTS | MBCS
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Primary Key without DataAnnotation for Windows Runtime

2014-04-01 Thread Paul
If I understood you right...

1) Create teable without primary key.
2) Separately create unique index on the column you want to be primary key.

> Hi,
> 
> 
> 
> we are building an App for Windows 8 and want to use sqlite as local DB. We
> want to separate our Models from our DB Engine. So we need a way to set the
> Primary Key without DataAnnotation. Is there a way?
> 
> 
> 
> Thanks a lot!
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Primary Key without DataAnnotation for Windows Runtime

2014-04-01 Thread Benedikt Neuhold
Hi,

 

we are building an App for Windows 8 and want to use sqlite as local DB. We
want to separate our Models from our DB Engine. So we need a way to set the
Primary Key without DataAnnotation. Is there a way?

 

Thanks a lot!

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users