2010-12-04 48 views
1

我正在使用Mindscape.Lightspeed並獲取以下錯誤: 錯誤:無效的對象名稱'KeyTable'。Mindscape.Lightspeed錯誤:無效的對象名稱'KeyTable'

LightSpeedContext<LightSpeedModel1UnitOfWork> context = new LightSpeedContext<LightSpeedModel1UnitOfWork>("Development"); 

     using (var uow = context.CreateUnitOfWork()) 
     { 
      SiteUser user = new SiteUser(); 
      user.UserName = "ABC"; 
      user.RoleId = 1; 

      uow.Add(user); 

     } 

回答

4

我發佈在官方論壇,在這裏你還張貼:-)

是因爲你使用的keytable身份方法生成此錯誤消息這個問題,這個commment。身份方法是LightSpeed如何爲您的實體生成標識符,並且默認情況下使用KeyTable模式。這需要一個名爲「KeyTable」的表(在提供者文件夾下的LightSpeed安裝目錄中有一個腳本)。

如果您不想使用KeyTable標識方法,請在.config文件的LightSpeedContext配置中配置適當的方法。有關幫助文件中的各種方法的信息,入門屏幕錄像和一些示例中的信息。

您可以在線閱讀這裏的幫助文件頁面:

http://www.mindscape.co.nz/Help/LightSpeed/Help%20Topics/LightSpeed/IdentityGeneration.html

我希望幫助,

約翰 - 丹尼爾

+0

下面是JD提到的幫助的直接鏈接:http://www.mindscapehq.com/documentation/lightspeed/Controlling-the-Database-Mapping/Identity-Generation – Myster 2012-09-06 07:42:19

0

爲您節省了一兩步,這裏的SQL從Lightspeed安裝文件夾在SQL Server 2008中創建KeyTable (C:\ Program Files(x86)\ Mindscape \ LightSpeed \ Providers \ SQLServer2008)

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name = 'KeyTable') 
BEGIN 
    DROP TABLE KeyTable 
END; 

CREATE TABLE KeyTable 
(
    NextId INT NOT NULL 
) 

INSERT INTO KeyTable VALUES (1); 
相關問題