EfCore-已经被Migration的Entity如何在其他Project中使用

如:PanelSummary这个Entity已经被其他Project进行了Migration,当前Project需要使用到此Entity,在EfCore的DbContext中可以这样设置即可:

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
                modelBuilder.Entity<PanelSummary>().Metadata.SetIsTableExcludedFromMigrations(true);
        }

 

posted @ 2021-10-30 11:23  北月、大魔王  阅读(66)  评论(1)    收藏  举报