小编Sim*_*uer的帖子

通用Windows平台的EF迁移

我有跟随DbContext,我想使用Entity Framwork迁移它

public class TestDbContext: DbContext
{
    public DbSet<State> States { get; set; }
    public DbSet<StateType> StateTypes { get; set; }
    public DbSet<Measure> Measures { get; set; }
    public DbSet<Priority> Priorities { get; set; }
    public DbSet<Task> Tasks { get; set; }
    public DbSet<TaskType> TaskTypes { get; set; }
    public DbSet<Document> Documents { get; set; }


    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        string databaseFilePath = "test.db";
        try
        {
            databaseFilePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, databaseFilePath);
        }
        catch (InvalidOperationException) { }
        optionsBuilder.UseSqlite($"Data source={databaseFilePath}");
    } …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework uwp

5
推荐指数
1
解决办法
485
查看次数

标签 统计

c# ×1

entity-framework ×1

uwp ×1