基于类型列的关系 [英] Relationship based on a type column

查看:61
本文介绍了基于类型列的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我有以下表格:

创建表AAA(id INT主键IDENTITY(1,1)非空);
创建表BBB(id INT主键IDENTITY(1,1)不为NULL);
创建表CCC(id INT PRIMARY KEY IDENTITY(1,1)NOT NULL
,xtype INT NOT NULL-1 AAA,2 BBB 
,xid INT NOT NULL
)


是否可以在LS中创建从AAA到CCC以及从BBB到CCC的关系?

Lets say I have the following tables:

CREATE TABLE AAA (id INT PRIMARY KEY IDENTITY(1, 1) NOT NULL);
CREATE TABLE BBB (id INT PRIMARY KEY IDENTITY(1, 1) NOT NULL);
CREATE TABLE CCC (id INT PRIMARY KEY IDENTITY(1, 1) NOT NULL
, xtype INT NOT NULL -- 1 AAA, 2 BBB 
, xid INT NOT NULL
)
Go

Can I create relationships from AAA to CCC, and from BBB to CCC in LS?

使用数据库变通办法,它可以通过多种方式实现(计算列,可更新视图等),但是在LS内部又如何呢?

Using database workarounds, it is achiveable in many ways (computed columns-updateable views-etc), but what about inside LS?

谢谢

推荐答案

我在这里可能会遗漏一些东西.您是否要附加到外部数据库?如果是这样,为什么不先在数据库本身中创建关系,然后再将其附加到LightSwitch中.附加数据源中的任何现有关系也将被建模 在LightSwitch中.

I might be missing something here. Are you attaching to an external database? If so, why don't you create the relationships in the database itself, before attaching it in LightSwitch. Any existing relationships in an attached data source will also be modelled in LightSwitch.

如果这使用的是内部数据(ApplicationData),我看不出问题出在哪里.

If this is using the intrinsic data (ApplicationData), I don't see where the problem is.


这篇关于基于类型列的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆