ICollection will not be added as a field in the entity framework, Why?

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

public class User
{
    [Key]
    public string userID { get; set; }
    public string username { get; set; }
    public virtual ICollection logs { get; set; }
    public User() { }
}

This is my class that I use for my DBSet but the initial migration only picks up the userID and userName

 public override void Up()
    {
        CreateTable(
            "dbo.Logs",
            c => new
                {
                    logID = c.String(nullable: false, maxLength: 128),
                    logString = c.String(),
                    logDatetime = c.DateTime(nullable: false),
                    User_userID = c.String(maxLength: 128),
                })
            .PrimaryKey(t => t.logID)
            .ForeignKey("dbo.Users", t => t.User_userID)
            .Index(t => t.User_userID);

        CreateTable(
            "dbo.Users",
            c => new
                {
                    userID = c.String(nullable: false, maxLength: 128),
                    username = c.String(),
                })
            .PrimaryKey(t => t.userID);

    }

So because it does not make that field, i cannot add to the logs because its non-existent can anyone explain to me how to use ICollections in my table?

asked 26 secs ago
Guywain

نویسنده : استخدام کار بازدید : 10 تاريخ : شنبه 1 ارديبهشت 1397 ساعت: 7:25

فهرست وبلاگ