Raw SQL Query without DbSet – Entity Framework Core

With Entity Framework Core removing dbData.Database.SqlQuery<SomeModel> I can’t find a solution to build a raw SQL Query for my full-text search query that will return the tables data and also the rank. The only method I’ve seen to build a raw SQL query in Entity Framework Core is via dbData.Product.FromSql(“SQL SCRIPT”); which isn’t useful as … Read more

The term “Add-Migration” is not recognized

I’m using this MSDN Tutorial to run in VS2015 the command PM> Add-Migration MyFirstMigration -context BloggingContext that ran yesterday successfully but today it’s giving the following error that is also pointed out by other users here. I even deleted the Migrations folder from solution explorer and the corresponding db from SQL Express 2014 on Win … Read more

Entity Framework Core add unique constraint code-first

I can’t find way to add a unique constraint to my field with using attribute: public class User { [Required] public int Id { get; set; } [Required] // [Index(“IX_FirstAndSecond”, 2, IsUnique = true)] not supported by core public string Email { get; set; } [Required] public string Password { get; set; } } I’m … Read more

How to unapply a migration in ASP.NET Core with EF Core

When I run PM> Remove-Migration -context BloggingContext in VS2015 with an ASP.NET Core project using EF Core I get the following error: System.InvalidOperationException: The migration ‘20160703192724_MyFirstMigration’ has already been applied to the database. Unapply it and try again. If the migration has been applied to other databases, consider reverting its changes using a new migration. … Read more

Command dotnet ef not found

I’m following the docs in order to create an initial migration. When I execute dotnet, I get the help section, meaning that the PATH works properly. Then I try to execute the command below from the docs in console window: dotnet ef migrations add InitialCreate I get the following error: Could not execute because the … Read more