Visual studio Sql Server CE外键显示为主键

Visual studio Sql Server CE外键显示为主键,visual-studio,sql-server-ce,foreign-key-relationship,sql-server-ce-4,Visual Studio,Sql Server Ce,Foreign Key Relationship,Sql Server Ce 4,至少在我看来是这样的。我正在使用SQLServerCE4.0和VisualStudio2010。这是我第一次使用SQLServerCE 例如,我有两张桌子。一种称为模板: TemplateID (int, primary key, identity) TemplateName (nvarchar) 另一种称为产品: ProductID (int, primary key, identity) TemplateID (int, foreign key relationship with Temp

至少在我看来是这样的。我正在使用SQLServerCE4.0和VisualStudio2010。这是我第一次使用SQLServerCE

例如,我有两张桌子。一种称为模板:

TemplateID (int, primary key, identity)
TemplateName (nvarchar)
另一种称为产品:

ProductID (int, primary key, identity)
TemplateID (int, foreign key relationship with Templates)
ProductName (nvarchar)
创建这些表之后,我尝试在Products中TemplateID字段上的表和TemplateID字段上的表之间建立外键关系

建立关系后,当我在服务器资源管理器中查看Products表时,我看到TemplateID已标记为Products中的主键。这不应该是该表中的主键

这仅仅是CE表的一些奇怪的表示方式吗?这意味着外键是其他表中的主键?看起来不是这样,因为单击Products表中的TemplateID列,并在Properties窗口中展开Identity标记,会显示该表是Products,而不是Templates


如果有人能解释一下这种奇怪的现象,我将非常感激。

一些测试证实外键不包括在主键中,尽管在Visual Studio中显示

显然,在VisualStudioServerExplorer中显示表的字段是一种笨拙、混乱的方式


是的。我已经想念Management Studio了…

您能在T-SQL中共享这两个表的模式吗?