Webapi和angularjs与OWIN身份验证 [英] Webapi and angularjs with OWIN athentication

查看:78
本文介绍了Webapi和angularjs与OWIN身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友



请支持我使用WebApi和AngularJs创建应用程序。我刚开始研究角度js和webApi。我了解所有相同技术的工作方式。在这里,我使用OWIN来验证Webapi和客户端请求。我的问题是如何重命名和添加默认表[AspNetUsers]名称和字段。如果你有任何小应用程序是基于这些分享我。我很满意你们。



我的尝试:



亲爱的朋友们



请支持我使用WebApi和AngularJs创建应用程序。我刚开始研究角度js和webApi。我了解所有相同技术的工作方式。在这里,我使用OWIN来验证Webapi和客户端请求。我的问题是如何重命名和添加默认表[AspNetUsers]名称和字段。如果你有任何小应用程序是基于这些分享我。我对你们都很满意。

Dear Friends

Please support me to create an application using WebApi and AngularJs. I have newly started work on angular js and webApi. I understand all the way to work on same technology. Here i am using OWIN to authenticate Webapi and Client request. My problem is how to rename and Add default table [AspNetUsers] name and field. If you have any small application is based on these do share me. I am very tankful to you all.

What I have tried:

Dear Friends

Please support me to create an application using WebApi and AngularJs. I have newly started work on angular js and webApi. I understand all the way to work on same technology. Here i am using OWIN to authenticate Webapi and Client request. My problem is how to rename and Add default table [AspNetUsers] name and field. If you have any small application is based on these do share me. I am very tankful to you all.

推荐答案

所以要将AspNetUsers重命名为不同的表名,你需要进入包含你的身份模型的文件。在该文件中,您还应该有一个ApplicationDbContext。在OnModelCreating方法中,您可以将更改映射到默认提供的内容。



So to rename AspNetUsers to a different table name you need to go into the file that contains your Identity Model. In that file, you should have an ApplicationDbContext as well. In the OnModelCreating method, this is where you will map your changes to what is provided by default.

modelBuilder.Entity<IdentityUser>().ToTable("MyNewUserTable").Property(p => p.Id).HasColumnName("UserId");
modelBuilder.Entity<MyNewUserTable>().ToTable("MyNewUserTable").Property(p => p.Id).HasColumnName("UserId");
modelBuilder.Entity<IdentityUserRole>().ToTable("MyNewUserTableRoles");
modelBuilder.Entity<IdentityUserLogin>().ToTable("MyNewUserTableLogins");
modelBuilder.Entity<IdentityUserClaim>().ToTable("MyNewUserTableClaims");
modelBuilder.Entity<IdentityRole>().ToTable("MyNewUserTableRoles");





在我的示例中,我已将AspNetUsers表重命名为MyNewUserTable,并且我还重命名了所有默认的Identity框架表。 />


有关这方面的更多信息,请参阅以下链接



c# - 如何在使用Visual Studio 2013时更改表名AspNet身份? - 堆栈溢出 [ ^ ]



重命名aspnetusers表 - Google搜索 [ ^ ]


这篇关于Webapi和angularjs与OWIN身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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