如何首先使用代码在已创建的数据库中创建ASP.net身份表? [英] How to create ASP.net identity tables in an already created database using code first?

查看:78
本文介绍了如何首先使用代码在已创建的数据库中创建ASP.net身份表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序已经开发了大约一个月.我现在决定使用ASP.NET Identity.我已经有了用于身份的视图模型,但是需要创建表.我当时在想,如果我有视图模型,为什么我还没有表呢?我不确定,这是为什么?我已经使用自己的自定义上下文在初始化程序中添加了create,我只需要知道如何获取EF即可为用户和角色构建包含的Identity表?我环顾四周,似乎没有答案是我需要的?

My application has been in development for about a month. I now decided to use ASP.NET Identity. I already have the view models for identity but need to create the tables. I was thinking and I am not exactly sure why I do not have the tables already if I have the view models?? I have drop create on in the initializer with my own custom context, I just need to know how to get EF to build the included Identity tables for users and roles? I looked around and none of the posted answers seem to be what I need?

推荐答案

因此,在阅读了一些摆弄后,我得到了答案.最后,我要做的就是从ASP.NET Identity中运行register方法,并创建了所有表.

So after a bit of reading a fiddling i got the answer. All I had to do was finally run the register method from ASP.NET Identity and all the tables were created.

这篇关于如何首先使用代码在已创建的数据库中创建ASP.net身份表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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