LocalDB is not supported on this Platform

.net-core .net-core-2.0 c# database entity-framework

Question

I'm trying to launch .Net Core 2.0 application on Ubuntu 17.04. I developed it on Windows 10 before and it works well. The problem is that when I run dotnet ef database update I get the next exception:

System.PlatformNotSupportedException: LocalDB is not supported on this Platform.

Here is my DbContext:

public class NutritionContext : DbContext
{
    public DbSet<User> Users { get; set; }
    public DbSet<Meal> Meals { get; set; }
    public DbSet<Dish> Dishes { get; set; }
    public DbSet<Product> Products { get; set; }
    public DbSet<Plan> Plans { get; set; }
    public DbSet<MealDish> MealDishes { get; set; }
    public DbSet<Ingredient> Ingredients { get; set; }
    public DbSet<PlanDetail> PlanDetails { get; set; }
    public DbSet<UserPlan> UserPlans { get; set; }
    public DbSet<AuthUser> AuthUsers { get; set; }

    public NutritionContext()
    {
    }

    public NutritionContext(DbContextOptions options) : base(options)
    {           
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer(
            "Server=(localdb)\\mssqllocaldb;Database=NutritionDatabaseNew;Trusted_Connection=True;MultipleActiveResultSets=true");
    }

}

Do you know what could be the reason of it?

1
15
8/24/2017 11:49:37 AM

Accepted Answer

LocalDb is a packaging mechanism for SQL Server Express Edition, and is only available for Windows. On Ubuntu you can install SQL Server 2017.

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-overview

https://docs.microsoft.com/en-us/sql/linux/sample-unattended-install-ubuntu

Or use the Docker Images:

https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker

14
11/4/2019 6:07:51 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow