Another trap
Today another strange behavior of the coding world.
Well I have setup Database Initializer with EF. I'm using DropCreateDatabaseIfModelChanges to Seed my database. What strange is that though I update my model class with new property the Seed method never triggered.
Google only give me article related to migration but I don't think that's the cause because when I run add-migrations there was no migration code created.
So, look back at my model class I saw a different.
public class Stock : EntityBase { [ScaffoldColumn (false)] public int ID { get; set; } public string Name { get; set; }
[UIHint("GridForeignKey")] public int CategoryID { get; set; }
[UIHint("GridForeignKey")] public int SubCategoryID { get; set; }
[UIHint("Integer")] public int LastQty { get; set; }
[UIHint("DescriptionText")] public string Description { get; set; }
public bool IsActive { get; set; }
[ScaffoldColumn(false)] public DateTime TimeStamp = DateTime.Now;
//Navigation Property [ForeignKey("CategoryID")] public Category Category { get; set; } [ForeignKey("SubCategoryID")] public SubCategory SubCategory { get; set; }
public string TestProperty;
}
The problem is that property TestProperty is not declared with {get; set}. EF seem to ignore property without {get; set;}.
After I put {get; set;}, EF kick in the seed method and and kendo form scafolding also work too.
Still don't know why this behavior occurs.













