Blazor WASM cannot use Entity Framework Core

Pubblicato il: 13 ottobre 2024
sul canale di: Emrah KAYA
12
0

Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram:   / ky.emrah  

Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!Blazor WASM cannot use Entity Framework Core

I am writing a Blazor WASM application in .NET 8. Today I tried to add fetching of database data to my app but I can't seem to get Entity Framework Core working. I am using the same libraries as I do always.
I have everything written like I always do but I just can't seem to find the issue. When I try to run the app and I try to fetch data from context in OnInitializedAsync method I get the following error in the console:
OnInitializedAsync

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Type MySql.Data.EntityFrameworkCore.Infrastructure.Internal.MySQLOptionsExtension+ExtensionInfo has invalid vtable method slot 5 with method none
System.TypeLoadException: Type MySql.Data.EntityFrameworkCore.Infrastructure.Internal.MySQLOptionsExtension+ExtensionInfo has invalid vtable method slot 5 with method none
at Microsoft.EntityFrameworkCore.DbContextOptions.GetHashCode()
at System.Collections.Concurrent.ConcurrentDictionary2[[Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptions, Microsoft.EntityFrameworkCore, Version=8.0.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.ValueTuple2[[System.IServiceProvider, System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[System.Collections.Generic.IDictionary2[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd[ValueTuple2](IDbContextOptions key, Func3 valueFactory, ValueTuple2 factoryArgument)
at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, Boolean providerRequired)
at Microsoft.EntityFrameworkCore.DbContext.get_ContextServices()
at Microsoft.EntityFrameworkCore.DbContext.get_Model()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1[[MyProject.Components.Models.Player, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_EntityType() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1[[MyProject.Components.Models.Player, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CheckState()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1[[MyProject.Components.Models.Player, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_EntityQueryable() at Microsoft.EntityFrameworkCore.Internal.InternalDbSet1[[MyProject.Components.Models.Player, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].System.Collections.Generic.IEnumerable.GetEnumerator()
at System.Collections.Generic.List1[[MyProject.Components.Models.Player, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[Player](IEnumerable`1 source)
at MyProject.Pages.Home.OnInitializedAsync() in C:\Users\FilipMráz\source\repos\MyProject\MyProject\Pages\Home.razor:line 112
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Type MySql.Data.EntityFrameworkCore.Infrastructure.InternSource of the question:
https://stackoverflow.com/questions/7...

Question and source license information:
https://meta.stackexchange.com/help/l...
https://stackoverflow.com/


In questa pagina del sito puoi guardare il video online Blazor WASM cannot use Entity Framework Core della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Emrah KAYA 13 ottobre 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 12 volte e gli è piaciuto 0 spettatori. Buona visione!