C
C#17mo 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
barcodeOP17mo ago
barcode
barcodeOP17mo ago
barcode
barcodeOP17mo ago
I'm using rider running on linux
@arch ~ $ dotnet --version
7.0.105
@arch ~ $ dotnet --version
7.0.105
Pobiega
Pobiega17mo ago
your dotnet --version isn't relevant to what version your project is using show your .csproj file instead @barcode
barcode
barcodeOP17mo 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
Pobiega17mo 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
barcodeOP17mo ago
it's included maybe it is because i am using postgres? but I checked their site and it says supported
Pobiega
Pobiega17mo 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
barcodeOP17mo 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
Pobiega17mo ago
hm okay my sample app also uses 7.0.9 and it works fine, also in Rider
barcode
barcodeOP17mo ago
oh good idea let me try to create a new project
Pobiega
Pobiega17mo ago
👍
barcode
barcodeOP17mo ago
and see if it detects sec could u give me the source if it is a 1 pager
Pobiega
Pobiega17mo 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
barcodeOP17mo ago
👍 create a new test creating* mediator cool i like
Pobiega
Pobiega17mo ago
specifically the source-gen version 🙂
barcode
barcodeOP17mo ago
😮
barcode
barcodeOP17mo ago
i will debug more, will find thei ssue was missing .Relational in my Application layer 😄
Pobiega
Pobiega17mo ago
Great 🙂
Want results from more Discord servers?
Add your server