1

为什么 Appharbor 不创建所有表。

我有以下实体框架配置。

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

    public DbSet<UserProfile> UserProfiles { get; set; }
    public DbSet<RegistrantInfo> RegistrantInfos { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

        modelBuilder.Entity<RegistrantInfo>().HasRequired(x => x.UserProfile).WithOptional(x => x.RegistrantInfo);
    }
}

public class RegistrantInfo
{
    public virtual int RegistrantInfoId { get; set; }
    public virtual string Name { get; set; }
    public virtual string Sex { get; set; }
    public virtual string BirthPlace { get; set; }
    public virtual string BirthDate { get; set; }
    public virtual string Address { get; set; }
    public virtual string ExamNumber { get; set; }
    public virtual UserProfile UserProfile { get; set; }
}

//this tables used by ASP.Net Simple Membership
[Table("UserProfile")]
public class UserProfile
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int UserId { get; set; }
    public string UserName { get; set; }
    public virtual RegistrantInfo RegistrantInfo { get; set; }
}    

connString :
<add name="DefaultConnection" connectionString="server=localhost\SqlExpress; database=RezaWeb; 
user id=sa; password=123456; MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />

在我的电脑里。已创建所有数据库表。RegistrationInfo + SimpleMembership 表(UserProfile、webpages_Membership、webpages_OAuthMembership、webpages_Roles、webpages_UsersInRoles)

在 appharbor 中:创建了所有 SimpleMembership 表,但未创建“RegistrationInfo”表。

为什么 ?

4

0 回答 0