0

我在尝试将基于代码的 mvc4 应用程序部署到天蓝色时遇到了一些问题。

它在创建 localdb 时工作正常,但是在尝试部署到 Azure UserProfile 表时,仅创建用户名和用户 ID 字段。

我的模型看起来像

[Table("UserProfile")]
public class UserProfile
{
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    public int UserId { get; set; }

    public Guid ConsumerId { get; set; }
    public string UserName { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Email { get; set; }
    public bool IsMale { get; set; }
    public string Mobile { get; set; }
    [DefaultValue(false)]
    public bool IsSmsVerified { get; set; }
    public string SmsVerificationCode { get; set; }

}

语境

  public class UsersContext : DbContext
{
    public UsersContext()
        : base("DefaultConnection")
    {
    }

    public DbSet<UserProfile> UserProfiles { get; set; }
    public DbSet<ExternalUserInformation> ExternalUsers { get; set; }
}

配置

 internal sealed class Configuration : DbMigrationsConfiguration<Web.Models.UsersContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = true;
    }

    protected override void Seed(Web.Models.UsersContext context)
    {
        //  This method will be called after migrating to the latest version.

        //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
        //  to avoid creating duplicate seed data. E.g.
        //
        //    context.People.AddOrUpdate(
        //      p => p.FullName,
        //      new Person { FullName = "Andrew Peters" },
        //      new Person { FullName = "Brice Lambson" },
        //      new Person { FullName = "Rowan Miller" }
        //    );
        //

        WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);

我需要打开的地方有魔法开关吗?

4

0 回答 0