Я пишу приложение Blazor WASM в .NET 8. Сегодня я попытался добавить извлечение данных базы данных в свое приложение, но я не могу получить основную работу фреймворта. Я использую одни и те же библиотеки, что и всегда. Когда я пытаюсь запустить приложение и пытаюсь извлечь данные из контекста в onInitializedAsync < /code> Метод. .Aspnetcore.components.webassembly.rendering.webassemblyrenderer [100] < /p>
Компонент рендеринга беззабочного исключения: тип mysql.data.entityframeworkcore.infrastructure.internal.mysqloptionseensens Метод none
system.typeloadexception: type mysql.data.entityframeworkcore.infrastructure.internal.mysqloptionsextension+extensionInfo имеет недопустимый vtable method slot 5 с методом < /p>
at microsoft.entityframeformcore. .Gethashcode ()
at system.collections.concurrent.concurrentdictionary2[[Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptions, Microsoft.EntityFrameworkCore, Version=8.0.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.ValueTuple 2 [[System.iserviceProvider, System.componentModel, версия = 8.0.0.0, культура = нейтральный, publickeyToken = b03f5f7f11d50a3a], [System.collections.generic.idicticaryary2[[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[ValueTuple 2] (idbcontextoptions, фанк3 valueFactory, ValueTuple< /code> 2 FactoryArgument)
at microsoft.entityframeworkcore.internal.serviceprovidercache.getoradd (idbcontextoptions, boolean providerrequired)
at microsoft.entityframeworkcore.dbcontext.get_contextsersers ()
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.InternalDbSet< /code> 1 [[[myproject.components.models.player, myproject, version = 1.0.0.0, culture = нейтральный, publickeytoken = null]]. checkstate ()
at microsoft.entityframeworkcore.internal ()
at microsoft.entityframeworkcore.internal () 1 [[myproject.components.models.player, myproject, version = 1.0.0.0, culture = нейтральный, 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(IEnumerable< /code> 1 Collection)
at system.linq.enumerable.tolist [player] (ienumerable`1 источник)
at myproject.pages.home.oninitializedAsync () в C: \ users \ filipmráz \ Source \ Repos \ myProject \ myProject \ pages \ home.razor: строка 112
at microsoft.aspnetcore.components.componentbase.runinitandSetParametersAsync () < /p>
< /blockquote>
Это код: < /p>
protected override async Task OnInitializedAsync()
{
var a = context.CreateDbContext().Players.ToList();
foreach (var item in a)
{
Console.WriteLine(item.Id);
}
}
Это мой dbcontext и объект dbset:
public class CustomDbContext : DbContext
{
public DbSet Players { get; set; }
public DbSet Tournaments { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseMySQL("myConString");
}
}
[Table("Players")]
public class Player
{
public int Id { get; set; }
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... ework-core
Blazor Wasm не может использовать ядро Ontity Framework ⇐ C#
Место общения программистов C#
-
Anonymous
1739725721
Anonymous
Я пишу приложение Blazor WASM в .NET 8. Сегодня я попытался добавить извлечение данных базы данных в свое приложение, но я не могу получить основную работу фреймворта. Я использую одни и те же библиотеки, что и всегда. Когда я пытаюсь запустить приложение и пытаюсь извлечь данные из контекста в onInitializedAsync < /code> Метод. .Aspnetcore.components.webassembly.rendering.webassemblyrenderer [100] < /p>
Компонент рендеринга беззабочного исключения: тип mysql.data.entityframeworkcore.infrastructure.internal.mysqloptionseensens Метод none
system.typeloadexception: type mysql.data.entityframeworkcore.infrastructure.internal.mysqloptionsextension+extensionInfo имеет недопустимый vtable method slot 5 с методом < /p>
at microsoft.entityframeformcore. .Gethashcode ()
at system.collections.concurrent.concurrentdictionary2[[Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptions, Microsoft.EntityFrameworkCore, Version=8.0.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.ValueTuple 2 [[System.iserviceProvider, System.componentModel, версия = 8.0.0.0, культура = нейтральный, publickeyToken = b03f5f7f11d50a3a], [System.collections.generic.idicticaryary2[[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[ValueTuple 2] (idbcontextoptions, фанк3 valueFactory, ValueTuple< /code> 2 FactoryArgument)
at microsoft.entityframeworkcore.internal.serviceprovidercache.getoradd (idbcontextoptions, boolean providerrequired)
at microsoft.entityframeworkcore.dbcontext.get_contextsersers ()
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.InternalDbSet< /code> 1 [[[myproject.components.models.player, myproject, version = 1.0.0.0, culture = нейтральный, publickeytoken = null]]. checkstate ()
at microsoft.entityframeworkcore.internal ()
at microsoft.entityframeworkcore.internal () 1 [[myproject.components.models.player, myproject, version = 1.0.0.0, culture = нейтральный, 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(IEnumerable< /code> 1 Collection)
at system.linq.enumerable.tolist [player] (ienumerable`1 источник)
at myproject.pages.home.oninitializedAsync () в C: \ users \ filipmráz \ Source \ Repos \ myProject \ myProject \ pages \ home.razor: строка 112
at microsoft.aspnetcore.components.componentbase.runinitandSetParametersAsync () < /p>
< /blockquote>
Это код: < /p>
protected override async Task OnInitializedAsync()
{
var a = context.CreateDbContext().Players.ToList();
foreach (var item in a)
{
Console.WriteLine(item.Id);
}
}
Это мой dbcontext и объект dbset:
public class CustomDbContext : DbContext
{
public DbSet Players { get; set; }
public DbSet Tournaments { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseMySQL("myConString");
}
}
[Table("Players")]
public class Player
{
public int Id { get; set; }
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79047139/blazor-wasm-cannot-use-entity-framework-core[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия