4
我想將我在Configuration.cs數據庫表和數據(用戶,用戶角色等)的初始化喜歡這篇文章中:http://blog.longle.net/2012/09/25/seeding-users-and-roles-with-mvc4-simplemembershipprovider-simpleroleprovider-ef5-codefirst-and-custom-user-properties/ASP .NET MVC 4:WebSecurity.CreateUserAndAccount如何設置用戶ID
但我有一個問題:是否有可能設置UserId添加用戶?我的意思是,我可以添加5個用戶,並且,我認爲他們應該獲得1-2-3-4-5個ID,但是我可以控制它並設置他們的ID手冊嗎?
現在初始化的樣子:
if (!WebSecurity.UserExists("elena"))
WebSecurity.CreateUserAndAccount("elena", "password");
我試圖用新的用戶名{= 2}做它,但它並沒有幫助 - 將創建一個用戶id = 1。這意味着,真的,我沒有在任何情況下首先控制研究用戶 – user1612334
@ user1612334 - 查看我的更新。 –
好的,thx ......... – user1612334