创建使用GUID和自定义表名与Asp.net 1.1身份阿尔法自定义实现 [英] Creating a Custom Implementation using Guid and Custom Table names with Asp.net Identity 1.1 Alpha

查看:204
本文介绍了创建使用GUID和自定义表名与Asp.net 1.1身份阿尔法自定义实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从不同的问题(如下面我想问的问题列出)绘制。

I'm drawing from different questions (listed below as I ask the question).

我想要做的五件事,并尽可能我可以从这些问题和答案......所有这一切都可以在我OnModelCreating方法进行告知。

I would like to do five things and as far as I can tell from these questions and answers... all of this can be done in my OnModelCreating method.

preface :我使用的是最新的夜间比特Asp.Net 1.1身份-α

Preface: I am using the latest nightly bits for Asp.Net Identity 1.1-alpha


  • 我想用的,而不是ID用户ID的属性我
    用户标识在AspNetUsers表。我明白这将涉及
    使用OnModelCreating十一五期间HasColumnName。

  • I would like to use "UserId" instead of Id as the property for my Users Id in the AspNetUsers table. I understand this would involve using "HasColumnName" during OnModelCreating.

我想使用的Guid(唯一标识符)作为数据类型我
用户ID(代替字符串)。我明白,这涉及到使用我的
拥有POCOS的IUSER类IUserStore等为郝酷嗯指示
在这里他的答案......

I would like to use Guid (uniqueidentifier) as the data type for my UserId (instead of string). I understand that this involves using my own POCOS for IUser class and IUserStore, etc as Hao Kung Indicates in his answer here...

<一个href=\"http://stackoverflow.com/questions/19553424/how-to-change-type-of-id-in-microsoft-aspnet-identity-entityframework-identityus/19577113#19577113\">How改变Microsoft.AspNet.Identity.EntityFramework.IdentityUser ID类型


  • 我想用我自己的自定义表名称,如MyRoles,
    MyCUserClaims,MyUserLogins,MyUserRoles,MyUsers如所示
    这个答案...

<一个href=\"http://stackoverflow.com/questions/19460386/how-can-i-change-the-table-names-when-using-visual-studio-2013-aspnet-identity\">How使用Visual Studio 2013 ASPNET身份时,我可以更改表名?


  • 所有的外键应与Asp.net apppropriately映射
    标识表作为郝骷嗯显示在这里...

<一个href=\"http://stackoverflow.com/questions/19932993/create-asp-net-identity-tables-using-sql-script/20057794#20057794\">Create使用SQL脚本ASP.NET身份表


  • 我想属性添加到名字的ApplicationUser
    和姓氏。

所以,基于上述...有人可以给我提供这将相应地创建这些标识表,用户ID与作为类型GUID(唯一标识符)的用户ID列中的OnModelCreating方法,在表中自定义的名称,关于名字的ApplicationUser和姓氏用适当的外键关系,并用两个附加属性?

So, based on the above... can someone provide me with the OnModelCreating method which would create these Identity tables accordingly, with UserId as the Id column for the users of type Guid (uniqueidentifier), in tables with custom names, with the appropriate foreign key relationships, and with two additional properties on ApplicationUser of FirstName and LastName?

推荐答案

正确的答案是从这个<一个href=\"http://stackoverflow.com/questions/19932993/create-asp-net-identity-tables-using-sql-script\">SO帖子。他没有公认的答案为特定的问题,但 @pwdst 发帖说包括我修改做的正是一个OnModelCreating答案因为我是问在这里。上周,我问他在这里发表,所以我可以接受他的答案,但他并没有这样做。所以我回答自己,指示您<一个href=\"http://stackoverflow.com/questions/19932993/create-asp-net-identity-tables-using-sql-script\">his回答这里。

The correct answer is from this SO Post. His was not the accepted answer for that particular question but @pwdst posted an answer that includes an OnModelCreating that I modified to do exactly as I was asking here. Last week I asked him to post here so I could accept his answer but he has not done so... therefore I'm answering myself and directing you to his answer here.

这篇关于创建使用GUID和自定义表名与Asp.net 1.1身份阿尔法自定义实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆