到aspnetusers加入柱数据库第一 [英] Add column to aspnetusers with database first

查看:225
本文介绍了到aspnetusers加入柱数据库第一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现有很多教程将列标识的表与数据库迁移(我已经成功地转移到应用程序数据库),但是我的理解是,这是不是适用于数据库的拳头项目。所以...我怎么在数据库中的第一个项目添加到aspnetusers表列?

I have found many tutorials for adding columns to the Identity tables (which I have successfully moved to the application database) with database migrations however my understanding is this is not applicable in database fist projects. So...how do I add columns to the aspnetusers table in a database first project?

我想广告堪称是RegComplete位类型列其最初设置为0,那么在某些时候,当用户已经完成了一些更多的任务,然后设置为1。

I would like to ad a bit type column called Is RegComplete which is initially set to 0 then at some point when the user has completed some more tasks then set to 1.

推荐答案

OK,我已经破解了!首先,我不知道,虽然我提出身份表应用数据库仍然有两台数据库环境中,一个用于应用程序表这是DB首先,和其他的标识表。

OK, I've cracked it! Firstly I didn't realise that although I have moved the Identity tables to the Application database there is still two Database Contexts, one for the application tables which are DB First, and the other for the Identities tables.

我是能够使迁移和首先使用code添加列和迁移然后更新数据库。新列现在可以在控制器中。

I was able to enable migrations and add the column using code first and migrate then update the database. The new column is now available in the controller.

我发现这个教程,帮助我:<一href=\"http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates.aspx\" rel=\"nofollow\">http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates.aspx

I found this tutorial which helped me: http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates.aspx

这篇关于到aspnetusers加入柱数据库第一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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