C
C#2y ago
barcode

✅ Issues with method not being available

Hello, I'm running latest version of .NET and latest version of EF Core and i'm trying to use bulk operations. https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-7.0/whatsnew#executeupdate-and-executedelete-bulk-updates The issue arrives when I try to call one of the new functions, they are not present in the definitions. Am I doing something wrong?
What's New in EF Core 7.0
Overview of new features in EF Core 7.0
19 Replies
barcode
barcodeOP2y ago
barcode
barcodeOP2y ago
barcode
barcodeOP2y ago
I'm using rider running on linux
@arch ~ $ dotnet --version
7.0.105
@arch ~ $ dotnet --version
7.0.105
Pobiega
Pobiega2y ago
your dotnet --version isn't relevant to what version your project is using show your .csproj file instead @barcode
barcode
barcodeOP2y ago
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GymRadar.Domain\GymRadar.Domain.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="FluentValidation" Version="11.5.2" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
</ItemGroup>

<ItemGroup>
<Folder Include="Features\Chains\Centers\Queries\" />
<Folder Include="Features\Chains\Specific\Commands\" />
<Folder Include="Features\Chains\Specific\Queries\" />
<Folder Include="Features\Shared\" />
<Folder Include="Features\Users\Centers\" />
<Folder Include="Features\Users\Specific\" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GymRadar.Domain\GymRadar.Domain.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="FluentValidation" Version="11.5.2" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
</ItemGroup>

<ItemGroup>
<Folder Include="Features\Chains\Centers\Queries\" />
<Folder Include="Features\Chains\Specific\Commands\" />
<Folder Include="Features\Chains\Specific\Queries\" />
<Folder Include="Features\Shared\" />
<Folder Include="Features\Users\Centers\" />
<Folder Include="Features\Users\Specific\" />
</ItemGroup>

</Project>
sorry went to take some food 7.0.9 ef core, .net 7.0
Pobiega
Pobiega2y ago
okay, thats fine. showe your usings in the file you are trying to use the methods in you need the using Microsoft.EntityFrameworkCore; to show those extensions
barcode
barcodeOP2y ago
it's included maybe it is because i am using postgres? but I checked their site and it says supported
Pobiega
Pobiega2y ago
are all the projects in the dependency-chain using EF 7.x? it shouldn't be pinning to 6, but it could nah postgre should be fine
barcode
barcodeOP2y ago
Yes, all use same version I made sure to update them all from 7.0.5 to 7.0.9 while i was trying to debug this
Pobiega
Pobiega2y ago
hm okay my sample app also uses 7.0.9 and it works fine, also in Rider
barcode
barcodeOP2y ago
oh good idea let me try to create a new project
Pobiega
Pobiega2y ago
👍
barcode
barcodeOP2y ago
and see if it detects sec could u give me the source if it is a 1 pager
Pobiega
Pobiega2y ago
its not. its a console app with a business dispatcher, migrations, configurations and stuff :p
using EFTestApp;
using EFTestApp.Data;
using Mediator;
using Microsoft.Extensions.Hosting;
using Serilog;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;

Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.MinimumLevel.Debug()
.CreateLogger();

var host = Host
.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TransactionBehavior<,>));
services.AddMediator(o => o.ServiceLifetime = ServiceLifetime.Scoped);

services.AddDbContext<TestAppContext>(x =>
x.UseSqlite(@"Data Source=D:\Code\temp\EFTestApp\EFTestApp\sqlite.db;"));

services.AddTransient<TestApp>();
})
.UseSerilog((ctx, lc) => lc.WriteTo.Console())
.Build();

var app = host.Services.GetRequiredService<TestApp>();

await app.Run();
using EFTestApp;
using EFTestApp.Data;
using Mediator;
using Microsoft.Extensions.Hosting;
using Serilog;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;

Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.MinimumLevel.Debug()
.CreateLogger();

var host = Host
.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TransactionBehavior<,>));
services.AddMediator(o => o.ServiceLifetime = ServiceLifetime.Scoped);

services.AddDbContext<TestAppContext>(x =>
x.UseSqlite(@"Data Source=D:\Code\temp\EFTestApp\EFTestApp\sqlite.db;"));

services.AddTransient<TestApp>();
})
.UseSerilog((ctx, lc) => lc.WriteTo.Console())
.Build();

var app = host.Services.GetRequiredService<TestApp>();

await app.Run();
barcode
barcodeOP2y ago
👍 create a new test creating* mediator cool i like
Pobiega
Pobiega2y ago
specifically the source-gen version 🙂
barcode
barcodeOP2y ago
😮
barcode
barcodeOP2y ago
i will debug more, will find thei ssue was missing .Relational in my Application layer 😄
Pobiega
Pobiega2y ago
Great 🙂

Did you find this page helpful?