2013-02-20 38 views
0

我有一個Employee表,其中包含一個類型爲uniqueidentifier的列User_Id,它是aspnet_Users中User_Id列的外鍵。當我嘗試使用User.Identity作爲參數去進入一個存儲過程一個新員工,它給了我這個錯誤:從表到aspnet_Users的外鍵:ASP.NET

No mapping exists from object type System.Security.Principal.GenericIdentity to a known managed provider native type.

我怎樣才能解決這個問題?關聯註冊的用戶和員工數據是必要的,因爲我需要能夠僅爲已登錄用戶檢索員工數據。

回答

0

IIdentity interface將爲您提供AuthenticationType,IsAuthenticated和Name屬性。我不認爲這些將會融入唯一標識符GUID字段。您可以嘗試獲取User.Identity.Name並將其放入一個普通的varchar字段中。這是否適合你的目的?