Quantcast
Channel: User learning... - Stack Overflow
Viewing all articles
Browse latest Browse all 38

no suitable method found to override onmodelCreating .net core 3.0

$
0
0

I have looked at a number of solutions but nothing helped so asking.

I am creating a very simple MvcApp in .Net Core 3.0 and it will be using EntityFramework 3.0 as well. This app is to learn .Net Core 3.0. I am using VS Code Editor Version: 1.40.1.

I have run the following commands (in order of appearance) to install EntityFramework:

>dotnet add package Microsoft.EntityFrameworkCore.Design>dotnet add package Microsoft.EntityFrameworkCore.Tools>dotnet add package Microsoft.EntityFrameworkCore.SqlServer >dotnet add package Microsoft.EntityFrameworkCore.Tools.DotNet >dotnet restore

The .csproj file looks like

<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup><TargetFramework>netcoreapp3.0</TargetFramework></PropertyGroup><ItemGroup></ItemGroup><ItemGroup><PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets><PrivateAssets>all</PrivateAssets></PackageReference><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" /><PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets><PrivateAssets>all</PrivateAssets></PackageReference><PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" /></ItemGroup></Project>

and the ApplicationDbContext look like

using Microsoft.EntityFrameworkCore;using OneDishParty.Models;//put the class inside a name spacenamespace OneDishParty.Data{    //Extend from DbContext    public class ApplicationDbContext : DbContext    {        //put the DbSet for the food items        public DbSet<FoodItem> FoodItems { get; set; }        //create constructor to load DbContext Options        public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)        {        }        //create the onModelCreating and pass in the builder        protected override void onModelCreating(ModelBuilder builder)        {            base.OnModelCreating(builder);        }    }}

onModelCreating is resulting in no suitable method found to override.

What am i missing here?


Viewing all articles
Browse latest Browse all 38

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>