Skip to content

Commit 1f3a996

Browse files
Merge pull request #126 from Genocs/ver_700
Update packages and refactor MongoDB repository methods
2 parents cd8588b + 6b7f29e commit 1f3a996

File tree

11 files changed

+23
-27
lines changed

11 files changed

+23
-27
lines changed

src/Genocs.Core.UnitTests/Genocs.Core.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1111
<PackageReference Include="xunit" Version="2.9.2" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/Genocs.Persistence.MongoDb.UnitTests/Genocs.Persistence.MongoDB.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
1212
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1414
<PackageReference Include="Moq" Version="4.20.72" />
1515
<PackageReference Include="xunit" Version="2.9.2" />
1616
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">

src/Genocs.Persistence.MongoDb/Domain/Repositories/IMongoDbBaseRepository.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Genocs.Core.Domain.Entities;
44
using Genocs.Core.Domain.Repositories;
55
using MongoDB.Driver;
6-
using MongoDB.Driver.Linq;
76

87
namespace Genocs.Persistence.MongoDb.Domain.Repositories;
98

@@ -12,7 +11,7 @@ public interface IMongoDbBaseRepository<TEntity, TKey> : IRepositoryOfEntity<TEn
1211
{
1312
IMongoCollection<TEntity> Collection { get; }
1413

15-
IMongoQueryable<TEntity> GetMongoQueryable();
14+
IQueryable<TEntity> GetMongoQueryable();
1615

1716
Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate);
1817
Task<IReadOnlyList<TEntity>> FindAsync(Expression<Func<TEntity, bool>> predicate);

src/Genocs.Persistence.MongoDb/Domain/Repositories/MongoDbBaseRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public MongoDbBaseRepository(IMongoDatabase database, string collectionName)
2222
/// It returns the Mongo Collection as Queryable.
2323
/// </summary>
2424
/// <returns></returns>
25-
public IMongoQueryable<TEntity> GetMongoQueryable()
25+
public IQueryable<TEntity> GetMongoQueryable()
2626
{
2727
return Collection.AsQueryable();
2828
}

src/Genocs.Persistence.MongoDb/Domain/Repositories/MongoDbBaseRepositoryOfType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
using System.Linq.Expressions;
12
using Genocs.Core.CQRS.Queries;
23
using Genocs.Core.Domain.Entities;
34
using Genocs.Core.Domain.Repositories;
45
using Genocs.Persistence.MongoDb.Repositories;
56
using MongoDB.Driver;
67
using MongoDB.Driver.Linq;
7-
using System.Linq.Expressions;
88

99
namespace Genocs.Persistence.MongoDb.Domain.Repositories;
1010

@@ -144,7 +144,7 @@ public override void Delete(TKey id)
144144
/// It returns the Mongo Collection as Queryable.
145145
/// </summary>
146146
/// <returns></returns>
147-
public IMongoQueryable<TEntity> GetMongoQueryable()
147+
public IQueryable<TEntity> GetMongoQueryable()
148148
=> Collection.AsQueryable();
149149

150150
public async Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate)

src/Genocs.Persistence.MongoDb/Encryptions/AzureInitializer.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
using Genocs.Persistence.MongoDb.Configurations;
2-
using Microsoft.Extensions.Options;
3-
using MongoDB.Bson;
4-
using MongoDB.Driver;
5-
using MongoDB.Driver.Encryption;
6-
7-
namespace Genocs.Persistence.MongoDb.Encryptions;
1+
namespace Genocs.Persistence.MongoDb.Encryptions;
82

93
/// <summary>
10-
/// The initializer
4+
/// The initializer.
115
/// </summary>
126
public class AzureInitializer
137
{
8+
/*
149
/// <summary>
15-
/// Setup the client
10+
/// Setup the client.
1611
/// </summary>
1712
/// <param name="options"></param>
1813
public AutoEncryptionOptions EncryptionOptions(IOptions<MongoDbEncryptionOptions> options)
@@ -179,4 +174,6 @@ BsonBinaryData CreateKeyGetID(DataKeyOptions options)
179174
//Console.WriteLine("Created encrypted collection!");
180175
// end-create-enc-collection
181176
}
177+
178+
*/
182179
}

src/Genocs.Persistence.MongoDb/Genocs.Persistence.MongoDb.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
</ItemGroup>
2727

2828
<ItemGroup>
29-
<PackageReference Include="MongoDB.Driver" Version="2.30.0" />
30-
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="1.5.0" />
29+
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
30+
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.0.0" />
3131
</ItemGroup>
3232

3333
</Project>

src/Genocs.Persistence.MongoDb/Repositories/Pagination.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
using System.Linq.Expressions;
12
using Genocs.Core.CQRS.Queries;
23
using MongoDB.Driver;
34
using MongoDB.Driver.Linq;
4-
using System.Linq.Expressions;
55

66
namespace Genocs.Persistence.MongoDb.Repositories;
77

88
public static class Pagination
99
{
1010
public static async Task<PagedResult<T>> PaginateAsync<T>(
11-
this IMongoQueryable<T> collection,
11+
this IQueryable<T> collection,
1212
IPagedQuery query)
1313
=> await collection.PaginateAsync(
1414
query.OrderBy,
@@ -17,7 +17,7 @@ public static async Task<PagedResult<T>> PaginateAsync<T>(
1717
query.Results);
1818

1919
public static async Task<PagedResult<T>> PaginateAsync<T>(
20-
this IMongoQueryable<T> collection,
20+
this IQueryable<T> collection,
2121
string? orderBy,
2222
string? sortOrder,
2323
int page = 1,
@@ -61,11 +61,11 @@ public static async Task<PagedResult<T>> PaginateAsync<T>(
6161
return PagedResult<T>.Create(data, page, resultsPerPage, totalPages, totalResults);
6262
}
6363

64-
public static IMongoQueryable<T> Limit<T>(this IMongoQueryable<T> collection, IPagedQuery query)
64+
public static IQueryable<T> Limit<T>(this IQueryable<T> collection, IPagedQuery query)
6565
=> collection.Limit(query.Page, query.Results);
6666

67-
public static IMongoQueryable<T> Limit<T>(
68-
this IMongoQueryable<T> collection,
67+
public static IQueryable<T> Limit<T>(
68+
this IQueryable<T> collection,
6969
int page = 1,
7070
int resultsPerPage = 10)
7171
{

src/Genocs.QueryBuilder.UnitTests/Genocs.QueryBuilder.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1515
<PackageReference Include="Moq" Version="4.20.72" />
1616
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.9" />
1717
<PackageReference Include="xunit" Version="2.9.2" />

src/Genocs.ServiceBusAzure.UnitTests/Genocs.ServiceBusAzure.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1111
<PackageReference Include="xunit" Version="2.9.2" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

0 commit comments

Comments
 (0)