Cloud.DataAccess.GenericRepository.UOM
1.0.1
dotnet add package Cloud.DataAccess.GenericRepository.UOM --version 1.0.1
NuGet\Install-Package Cloud.DataAccess.GenericRepository.UOM -Version 1.0.1
<PackageReference Include="Cloud.DataAccess.GenericRepository.UOM" Version="1.0.1" />
paket add Cloud.DataAccess.GenericRepository.UOM --version 1.0.1
#r "nuget: Cloud.DataAccess.GenericRepository.UOM, 1.0.1"
// Install Cloud.DataAccess.GenericRepository.UOM as a Cake Addin #addin nuget:?package=Cloud.DataAccess.GenericRepository.UOM&version=1.0.1 // Install Cloud.DataAccess.GenericRepository.UOM as a Cake Tool #tool nuget:?package=Cloud.DataAccess.GenericRepository.UOM&version=1.0.1
This Nuget package is used to do the unit of work pattern. How we have to use the code in our application as below
public static void AddAppDependencies(this IServiceCollection services, IConfiguration configuration) {
////Add contexts
services.AddDbContext<xxxxxDbContext>(options => options.UseSqlServer(configuration.GetConnectionString("ConnectionString")));
////Security Implementation
services.AddSingleton<IConfiguration>(configuration);
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<IContextHelper, ContextHelper>();
//Service
services.AddTransient<IxxxService, xxxServiceImplementation>();
//Repository
services.AddTransient<IxxxRepository ,xxxRepositoryImplementation>();
///UnitofWork Register
services.AddScoped<IUnitOfWorkRead, UnitOfWorkRead<xxxxxDbContext>>();
services.AddScoped<IUnitOfWorkWrite, UnitOfWorkWrite<xxxxxDbContext>>();
}
/////And above code how to use in our startup.cs
public void ConfigureServices(IServiceCollection services) { //to work with include linq statment (navigaiton properties) services.AddMvc() .AddJsonOptions( options ⇒ options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore );
//max json string length
services.AddMvc()
.AddJsonOptions(
options => options.SerializerSettings.MaxDepth = int.MaxValue
);
//global exception handler
services.AddMvc(
config =>
{
config.Filters.Add(typeof(ApiExceptionFilter));
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
// CORS enabled
services.AddCors(o => o.AddPolicy("corsname", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
}));
services.Configure<IISOptions>(options =>
{
options.AutomaticAuthentication = false;
});
//register dependencies(DI)
services.AddAppDependencies(Configuration); ///This method is linked with above code.
var serviceProvider = services.BuildServiceProvider();
}
////How to use this unit of work in repository class List<Dbset> objDbset=await _unitOfWork.GetRepository<Dbset>().GetAll().ToListAsync();///To get _unitOfWork.GetRepository<Dbset>().GetFirstOrDefault(predicate: x ⇒ x.Id == search.Id && !x.Canceledby.HasValue); //////////// await _unitOfWork.GetRepository<DbSet>().InsertAsync(listDbsetValue, ct);////CancellationToken ct = default(CancellationToken) await _unitOfWork.SaveChangesAsync(); //////////////////////// unitOfWork.GetRepository<DbSet>().Update(listDbSet); await _unitOfWork.SaveChangesAsync();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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 | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.1
- JsonTransformation (>= 1.0.1)
- Microsoft.AspNetCore.Http (>= 2.2.0)
- Microsoft.EntityFrameworkCore (>= 2.2.0)
- Microsoft.EntityFrameworkCore.Relational (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.