LINQ to SQL relationships using compact edition -


i'm having problem trying use linq sql create relationship between 2 database entities. i've been following this basic microsoft guide without getting work.

i'm trying store tree-like structure. configunit class contains information category of items , stores tree name root node.

storeitem contains information each node in tree.

[table(name = "configunit")] public class configunit {     [column(isprimarykey = true, isdbgenerated = true)]     public int cuid;      ...      private entityset<storeitem> _rootnode;     [association(storage = "_rootnode", thiskey = "cuid", otherkey = "cuid")]     public entityset<storeitem> rootnode     {                 {             return _rootnode;         }         set         {             _rootnode = value;         }     } } 

and storeitem class:

[table(name = "storeitem")] public class storeitem {     [column(isprimarykey = true, isdbgenerated = true)]     public int siid;      [column]     public int cuid;      private entityref<configunit> _cu;     [association(storage = "_cu", thiskey = "cuid")]     public configunit configunit     {         { return this._cu.entity; }         set { this._cu.entity = value; }     }      ... } 

however when run code , database created using datacontext.createdatabase() relation not seem created. configunit table has no relationship column , no relationship values seem stored when query database afterwards.

what missing? i'm running near-identical relationship linked microsoft article.

thanks time!

edit: generated sql code this:

 create table [configunit](    [cuid] int not null identity,     [topid] int not null,     constraint [pk_configunit] primary key ([cuid])    ) 

ie no relation generated @ all. other related problem find people missing primary keys on entities, not.

edit 2: tried using full sql server instead of compact edition one. still same result.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -