Hello,
I am starting using Entity Framework and I have the following SQL tables:
create table Tags
(
TagID uniqueidentifier not null
constraint PK_Tag primary key clustered,
[Name] nvarchar(100) null
) -- Tags
-- Articles
create table Articles
(
ArticleID uniqueidentifier not null
constraint PK_Article primary key clustered,
Body nvarchar(max) null,
Created datetime null,
Excerpt nvarchar(max) null,
Published bit null,
Title nvarchar(400) null,
Updated datetime null
) -- Articles
-- ArticleTags
create table ArticleTags
(
ArticleID uniqueidentifier not null,
TagID uniqueidentifier not null,
constraint PK_ArticleTags
primary key clustered (ArticleID, TagID),
constraint FK_ArticleTags_Articles
foreign key(ArticleID)
references Articles(ArticleID)
on delete cascade,
constraint FK_ArticleTags_Tags
foreign key(TagID)
references Tags(TagID)
on delete cascade
) -- ArticleTags The problem with my code is when I create the Entities I get for each entity ArticleID and TagID instead of only ID.
I checked the following example and this case the author get ID in all primary keys of all entities:
http://msdn.microsoft.com/en-us/data/cc546556.aspx
Could you tell me how to change my code to accomplish that?
And is there something I should change on my code?
Should I remove the delete cascade and take care of that on my repositories?
Thanks,
Miguel