To reproduce:
public class Movie
{
public int ID { get; set; }
public string Title { get; set; }
public DateTime ReleaseDate { get; set; }
public string Genre { get; set; }
public decimal Price { get; set; }
}
3.Scaffold
Still happend
@hernanbignone see https://github.com/aspnet/EntityFramework/issues/7891
it worked by installing package Microsoft.EntityFrameworkCore.Sqlite.Core
I need to use SQLServer, not SQLite so added package Microsoft.EntityFrameworkCore.SqlServer
This is likely because you've not got the package installed, https://github.com/aspnet/EntityFrameworkCore/issues/7891#issuecomment-401540512.
Open your console and navigate to the project folder, then run this:
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
You'll need to then add a using Microsoft.EntityFrameworkCore.Sqlite
to the top of your class.
See here: https://docs.microsoft.com/en-us/ef/core/get-started/netcore/new-db-sqlite
yes.ok
You gonna need to install some nugget, create a table and do db-migration
Open your console and navigate to the project folder, then run this:
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
You'll need to then add a
using Microsoft.EntityFrameworkCore.Sqlite
to the top of your class.See here: https://docs.microsoft.com/en-us/ef/core/get-started/netcore/new-db-sqlite
Thank you... this worked for me after I've updated my app from core 2.1 to 3.1 it must've removed that using reference. So easy to miss.
I don't get it.
why all this..
Just add
using Microsoft.EntityFrameworkCore;
Just read the library before using it... why nobody does that..
I am doing tutorial now which gave same issue until I added
Install-Package Microsoft.EntityFrameworkCore.InMemory
I am doing tutorial now which gave same issue until I added
Install-Package Microsoft.EntityFrameworkCore.InMemory
why do you need Microsoft.EntityFrameworkCore.InMemory
To do UseSqlServer call
Which is static function in Microsoft.EntityFrameworkCore(Microsoft.EntityFrameworkCore.SqlServer.dll)
//
// Summary:
// Configures the context to connect to a Microsoft SQL Server database.
//
// Parameters:
// optionsBuilder:
// The builder being used to configure the context.
//
// connectionString:
// The connection string of the database to connect to.
//
// sqlServerOptionsAction:
// An optional action to allow additional SQL Server specific configuration.
//
// Returns:
// The options builder so that further configuration can be chained.
public static DbContextOptionsBuilder UseSqlServer([NotNullAttribute] this DbContextOptionsBuilder optionsBuilder, [NotNullAttribute] string connectionString, [CanBeNullAttribute] Action
//
// Summary:
// Configures the context to connect to a Microsoft SQL Server database.
//
// Parameters:
// optionsBuilder:
// The builder being used to configure the context.
//
// connection:
// An existing System.Data.Common.DbConnection to be used to connect to the database.
// If the connection is in the open state then EF will not open or close the connection.
// If the connection is in the closed state then EF will open and close the connection
// as needed.
//
// sqlServerOptionsAction:
// An optional action to allow additional SQL Server specific configuration.
//
// Returns:
// The options builder so that further configuration can be chained.
public static DbContextOptionsBuilder UseSqlServer([NotNullAttribute] this DbContextOptionsBuilder optionsBuilder, [NotNullAttribute] DbConnection connection, [CanBeNullAttribute] Action
@jspalding70
I am doing tutorial now which gave same issue until I added
Install-Package Microsoft.EntityFrameworkCore.InMemory
That's in the tutorial.
@jspalding70
I am doing tutorial now which gave same issue until I added
Install-Package Microsoft.EntityFrameworkCore.InMemory
That's in the tutorial.
Oka so you use SQLite
This topic its about MS SQL and EFCore..
When i work with EFCore
I use Microsoft.EntityFrameworkCore.SqlServer.dll and Microsoft.EntityFrameworkCore.Proxies.dll
use of UseLazyLoadingProxies
Microsoft.EntityFrameworkCore.Sqlite better to use with Microsoft.EntityFrameworkCore.Proxies then Microsoft.EntityFrameworkCore.InMemory
CPU lower cost..
Step 1: Right click your project
Step 2: Manage NuGet Package
Step 3. Browse tab
Step 4. Search ( Microsoft.EntityFrameworkCore.SqlServer )
Step 5. Install
Step 6. build
Step 7. Success................................................................
added package Microsoft.EntityFrameworkCore.SqlServer
I think the confusion is that people are trying this out for the first time and the little blue checkmark is confusing them into thinking the package is already installed.... not very good UI design IMHO
Step 1: Right click your project
Step 2: Manage NuGet Package
Step 3. Browse tab
Step 4. Search ( Microsoft.EntityFrameworkCore.SqlServer )
Step 5. Install
Step 6. build
Step 7. Success................................................................added package Microsoft.EntityFrameworkCore.SqlServer
Dude, u saved me!!! Thanks bro! God bless ya
After installing Microsoft.EntityFrameworkCore.SqlServer Nuget package my issue resolved.
Most helpful comment
I need to use SQLServer, not SQLite so added package Microsoft.EntityFrameworkCore.SqlServer