Bat.EntityFrameworkCore.Tools
8.0.1
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
dotnet add package Bat.EntityFrameworkCore.Tools --version 8.0.1
NuGet\Install-Package Bat.EntityFrameworkCore.Tools -Version 8.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bat.EntityFrameworkCore.Tools" Version="8.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bat.EntityFrameworkCore.Tools --version 8.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bat.EntityFrameworkCore.Tools, 8.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Bat.EntityFrameworkCore.Tools as a Cake Addin #addin nuget:?package=Bat.EntityFrameworkCore.Tools&version=8.0.1 // Install Bat.EntityFrameworkCore.Tools as a Cake Tool #tool nuget:?package=Bat.EntityFrameworkCore.Tools&version=8.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
For use Bat.EntityFrameworkCore.Tools just do it :
1- Install Bat.EntityFrameworkCore.Tools on your project
2- Register IEFBulkGenericRepo<TEntity> to service container for example :
builder.Services.AddTransient<IEFBulkGenericRepo<User>, EFBulkGenericRepo<User>>();
builder.Services.AddTransient<IEFBulkGenericRepo<Address>, EFBulkGenericRepo<Address>>();
builder.Services.AddScoped<AppBulkUnitOfWork>();
3- Use it in bussiness logic for example :
// Create DbContext
public class AppDbContext : BatDbContext
{
public AppDbContext() { }
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
protected override void OnModelCreating(ModelBuilder builder)
{
builder.ApplyConfigurationsFromAssembly(typeof(AppUnitOfWork).Assembly);
base.OnModelCreating(builder);
}
public DbSet<User> Users { get; set; }
public DbSet<Address> Addresses { get; set; }
}
// Create UnitOfWork
public class AppBulkUnitOfWork
{
private readonly AppDbContext _appDbContext;
private readonly IServiceProvider _serviceProvider;
public AppBulkUnitOfWork(AppDbContext appDbContext, IServiceProvider serviceProvider)
{
_appDbContext = appDbContext;
_serviceProvider = serviceProvider;
}
public EFBulkGenericRepo<User> UserBulkRepo => (EFBulkGenericRepo<User>)_serviceProvider.GetRequiredService<IEFBulkGenericRepo<User>>();
public EFBulkGenericRepo<Address> AddressBulkRepo => (EFBulkGenericRepo<Address>)_serviceProvider.GetRequiredService<IEFBulkGenericRepo<Address>>();
public EFBulkGenericRepo<T> GetBulkRepository<T>() where T : class, IBaseEntity
=> EFBulkGenericRepo<T>)_serviceProvider.GetRequiredService<IEFBulkGenericRepo<T>>();
public void Dispose()
{
_appDbContext.Dispose();
GC.SuppressFinalize(this);
}
}
// Use power Off EFBulkGenericRepo
public class UserService : IUserService
{
private readonly AppBulkUnitOfWork _appBulkUow;
public UserService(AppBulkUnitOfWork appBulkUow)
{
_appBulkUow = appBulkUow;
}
public async Task ExecuteSample()
{
var users = new List<User>
{
new User { UserId = 1, FirstName = "Mehdi", LastName = "Norouzi" },
new User { UserId = 2, FirstName = "Mehran", LastName = "Norouzi" },
new User { UserId = 3, FirstName = "Kamran", LastName = "Norouzi" }
};
await _appBulkUow.UserBulkRepo.BulkInsertAsync(users);
await _appBulkUow.GetBulkRepository<User>().BulkDeleteAsync(users);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Bat.EntityFrameworkCore (>= 1.1.3)
- EFCore.BulkExtensions (>= 5.2.8)
-
net5.0
- Bat.EntityFrameworkCore (>= 1.1.3)
- EFCore.BulkExtensions (>= 5.2.8)
- Microsoft.EntityFrameworkCore.Analyzers (>= 5.0.13)
- Microsoft.EntityFrameworkCore.Relational (>= 5.0.13)
-
net6.0
- Bat.EntityFrameworkCore (>= 7.0.2)
- EFCore.BulkExtensions (>= 7.0.1)
- Microsoft.EntityFrameworkCore.Analyzers (>= 7.0.2)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.2)
-
net7.0
- Bat.EntityFrameworkCore (>= 7.0.3)
- EFCore.BulkExtensions (>= 7.1.6)
-
net8.0
- Bat.EntityFrameworkCore (>= 8.0.1)
- EFCore.BulkExtensions (>= 8.0.1)
- Microsoft.Data.SqlClient (>= 5.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.1 | 374 | 1/22/2024 |
8.0.0 | 195 | 12/1/2023 |
7.0.3 | 393 | 3/1/2023 |
7.0.2 | 294 | 2/4/2023 |
7.0.0 | 363 | 12/6/2022 |
6.0.22 | 193 | 8/21/2023 |
6.0.21 | 162 | 8/19/2023 |
6.0.1 | 732 | 3/27/2022 |
1.1.4 | 425 | 12/26/2021 |
1.1.3 | 562 | 7/12/2021 |
1.1.2 | 399 | 7/12/2021 |
1.1.1 | 507 | 4/14/2021 |
1.1.0 | 505 | 3/26/2021 |
1.0.8 | 425 | 2/7/2021 |
1.0.7 | 483 | 2/4/2021 |
1.0.6 | 458 | 1/30/2021 |
1.0.5 | 579 | 10/27/2020 |
1.0.4 | 586 | 10/20/2020 |
- Upgrade to Net8.0 and C#12.0
- Upgrade to EF8.0
- Add BulkRepositoryFactory
- Add GetBulkRepository ExtensionMethod