在Microsoft Oslo SDK CTP 2008 (使用Intellipad)中,以下代码可以很好地编译:
module T {
type A {
Id : Integer32 = AutoNumber();
} where identity Id;
As : A*;
type B {
Id : Integer32 = AutoNumber();
// A : A;
// } where A in As && identity Id;
} where identity Id;
Bs : B*;
type C {
Id : Integer32 = AutoNumber();
B : B;
} where B in Bs && identity Id;
Cs : C*;
}并产生以下Reach SQL输出:
set xact_abort on;
go
begin transaction;
go
set ansi_nulls on;
go
create schema [T];
go
create table [T].[As]
(
[Id] int not null identity,
constraint [PK_As] primary key clustered ([Id])
);
go
create table [T].[Bs]
(
[Id] int not null identity,
constraint [PK_Bs] primary key clustered ([Id])
);
go
create table [T].[Cs]
(
[Id] int not null identity,
[B] int not null,
constraint [PK_Cs] primary key clustered ([Id]),
constraint [FK_Cs_B_T_Bs] foreign key ([B]) references [T].[Bs] ([Id])
);
go
commit transaction;
go但在更改模块T中的注释行后,如下所示
A : A;
} where A in As && identity Id;
// } where identity Id;将显示错误消息"M2037: SQL生成内部错误:缺少变量‘A’的生成器“(在Intellipad的Reach SQL窗口中)。
有什么想法吗?
向您致敬,坦伯格
发布于 2008-10-31 18:37:29
我想你想要的是:
type A {
Id : Integer32 = AutoNumber();
} where identity Id;
As : A*;
type B {
Id : Integer32 = AutoNumber();
A : A;
} where identity Id;
Bs : (B where value.A in As)*;
type C {
Id : Integer32 = AutoNumber();
B : B;
} where identity Id && B in Bs;
Cs : (C where value.B in Bs)*;请注意,约束是在外部类型上,而不是这里的类型上。当约束放在类型上时,我能够得到类似的代码,但不能深入到一个以上的关系。将它们移动到externs似乎是正确的,并生成预期的到达SQL。
发布于 2008-10-31 21:00:05
http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/05103bf8-4e0f-4976-bcdd-2c724cb08738/
https://stackoverflow.com/questions/253746
复制相似问题