Skip to content

Commit

Permalink
Commit for 6.0.0-preview1
Browse files Browse the repository at this point in the history
  • Loading branch information
TanvirArjel committed Oct 19, 2022
1 parent c30fe44 commit 368f5e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
42 changes: 7 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ specification.Conditions.Add(e => e.Name.Contains("Ta"));
specification.PageIndex = 1;
specification.PageSize = 10;

PaginatedList<EmployeeDto> paginatedList = await _repository.GetPaginatedListAsync(specification, e => new EmployeeDto
PaginatedList<EmployeeDto> paginatedList = await _repository.GetListAsync(specification, e => new EmployeeDto
{
Id = e.Id
Name = e.Name,
Expand All @@ -39,7 +39,7 @@ List<EmployeeDto> items = await _repository.GetFromRawSqlAsync<EmployeeDto>(sqlQ

## ⚙️ This library includes following notable features:

1. This library can be run on any .NET Core or .NET application which has .NET Core 3.1, .NET Standard 2.1 and .NET 5.0 support.
1. This library can be run on any .NET Core or .NET application which has .NET Core 3.1, .NET Standard 2.1 and .NET 5.0+ support.

2. It’s providing the Generic Repository with database transaction support.

Expand Down Expand Up @@ -89,7 +89,7 @@ public void ConfigureServices(IServiceCollection services)

// If multiple DbContext
services.AddGenericRepository<YourDbContext1>();
services.AddGenericRepository<YourDbContext1>();
services.AddGenericRepository<YourDbContext2>();
}
```

Expand Down Expand Up @@ -119,7 +119,7 @@ public void ConfigureServices(IServiceCollection services)

// For multiple DbContext
services.AddQueryRepository<YourDbContext1>();
services.AddQueryRepository<YourDbContext1>();
services.AddQueryRepository<YourDbContext2>();
}
```

Expand Down Expand Up @@ -159,40 +159,12 @@ public class EmployeeService
_dbConext1Repository = dbConext1Repository;
}

// Single database operation.
public async Task<int> CreateAsync(Employee employee)
{
object[] primaryKeys = await _repository.InsertAsync(employee);
return (int)primaryKeys[0];
}
await _repository.AddAsync(employee);
await _repository.SaveChangesAsync();

// Multiple database operations.
public async Task<int>> CreateAsync(Employee employee)
{
IDbContextTransaction transaction = await _repository.BeginTransactionAsync(IsolationLevel.ReadCommitted);
try
{
object[] primaryKeys = await _repository.InsertAsync(employee);

long employeeId = (long)primaryKeys[0];
EmployeeHistory employeeHistory = new EmployeeHistory()
{
EmployeeId = employeeId,
DepartmentId = employee.DepartmentId,
EmployeeName = employee.EmployeeName
};

await _repository.InsertAsync(employeeHistory);

await transaction.CommitAsync();

return employeeId;
}
catch (Exception)
{
await transaction.RollbackAsync();
throw;
}
return employee.Id;
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

This library includes the following notable features:

1. This library can be run on any .NET Core or .NET application which has .NET Core 3.1, .NET Standard 2.1 and .NET 5.0 support.
1. This library can be run on any .NET Core or .NET application which has .NET Core 3.1, .NET Standard 2.1 and .NET 5.0+ support.

2. It’s providing the Generic Repository with database transaction support.

Expand Down

0 comments on commit 368f5e2

Please sign in to comment.