Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 亚音速3生成的简单假设关系是错误的_C#_Sql Server 2005_Asp.net Mvc 2_Subsonic3_Subsonic Simplerepository - Fatal编程技术网

C# 亚音速3生成的简单假设关系是错误的

C# 亚音速3生成的简单假设关系是错误的,c#,sql-server-2005,asp.net-mvc-2,subsonic3,subsonic-simplerepository,C#,Sql Server 2005,Asp.net Mvc 2,Subsonic3,Subsonic Simplerepository,有人告诉我,很可能是我的数据库设置错误导致了问题,下面是我的表,其中包含关键字段和查询 CREATE TABLE Presentations ( Id INT NOT NULL IDENTITY(1, 1), SpeakerId INT NOT NULL, CONSTRAINT PK_Presentations PRIMARY KEY (Id), CONSTRAINT FK_Presentations_Speaker FOREIGN KEY (SpeakerId

有人告诉我,很可能是我的数据库设置错误导致了问题,下面是我的表,其中包含关键字段和查询

CREATE TABLE Presentations (
    Id INT NOT NULL IDENTITY(1, 1),
    SpeakerId INT NOT NULL,

    CONSTRAINT PK_Presentations PRIMARY KEY (Id),
    CONSTRAINT FK_Presentations_Speaker FOREIGN KEY (SpeakerId) REFERENCES Speakers (Id)
)

CREATE TABLE Speakers (
    Id INT NOT NULL IDENTITY(1, 1),

    CONSTRAINT PK_Speakers PRIMARY KEY (Id)
)
当我执行以下操作时:

presentations = presentations.OrderBy(x => x.Speaker.FirstName);
生成的查询如下所示:

SELECT  [t0].[Description], [t0].[EventId], [t0].[Id], [t0].[PresentedOn], 
        [t0].[Slug], [t0].[SpeakerId], [t0].[Title], [t0].[Url]
FROM    [Presentations] AS t0
LEFT    OUTER JOIN [Speakers] AS t1 ON ([t1].[Id] = [t0].[Id])
WHERE   ([t1].[FirstName] LIKE 'B' + '%')
ORDER   BY [t1].[FirstName]
连接应为:

LEFT    OUTER JOIN [Speakers] AS t1 ON ([t1].[Id] = [t0].[SpeakerId])
这是个紧急问题,有人能帮忙吗

相关问题:


非常感谢您的帮助。

我们可能会对表中的键名称进行一些假设,但我不这么认为。您使用的是什么版本?生成的表信息是否具有键的正确名称?表没有生成,我对它们进行了编码,因为我不总是使用SubSonic3Did。您解决了这个问题,我对一些破坏了我模式的真正黑客代码很感兴趣。研究其他选择。