diff --git a/samples/AspNetCoreSample/Pages/Index.cshtml.cs b/samples/AspNetCoreSample/Pages/Index.cshtml.cs index 269943a..8ed72a3 100644 --- a/samples/AspNetCoreSample/Pages/Index.cshtml.cs +++ b/samples/AspNetCoreSample/Pages/Index.cshtml.cs @@ -12,7 +12,7 @@ // You should have received a copy of the GNU Lesser General Public License along with MongODM. // If not, see . -using Etherna.MongoDB.Driver; +using Etherna.MongoDB.Driver.Linq; using Etherna.MongODM.AspNetCoreSample.Models; using Etherna.MongODM.AspNetCoreSample.Persistence; using Microsoft.AspNetCore.Mvc; diff --git a/src/MongODM.Core/Conventions/HierarchicalProxyTolerantDiscriminatorConvention.cs b/src/MongODM.Core/Conventions/HierarchicalProxyTolerantDiscriminatorConvention.cs index f3327b7..f53bc53 100644 --- a/src/MongODM.Core/Conventions/HierarchicalProxyTolerantDiscriminatorConvention.cs +++ b/src/MongODM.Core/Conventions/HierarchicalProxyTolerantDiscriminatorConvention.cs @@ -26,7 +26,7 @@ namespace Etherna.MongODM.Core.Conventions { - public class HierarchicalProxyTolerantDiscriminatorConvention : IDiscriminatorConvention + public class HierarchicalProxyTolerantDiscriminatorConvention : IHierarchicalDiscriminatorConvention { // Fields. private readonly IDbContext? _dbContext; //remove nullability with constructors that don't ask it, when will be possible diff --git a/src/MongODM.Core/Extensions/EnumerableExtensions.cs b/src/MongODM.Core/Extensions/EnumerableExtensions.cs index 49637be..e48f780 100644 --- a/src/MongODM.Core/Extensions/EnumerableExtensions.cs +++ b/src/MongODM.Core/Extensions/EnumerableExtensions.cs @@ -60,8 +60,8 @@ public static IEnumerable Paginate( /// Elements per page /// Selected elements page /// Throw with invalid parameter values - public static IMongoQueryable Paginate( - this IMongoQueryable values, + public static IQueryable Paginate( + this IQueryable values, Expression> orderKeySelector, int page, int take) @@ -114,8 +114,8 @@ public static IEnumerable PaginateDescending( /// Elements per page /// Selected elements page /// Throw with invalid parameter values - public static IMongoQueryable PaginateDescending( - this IMongoQueryable values, + public static IQueryable PaginateDescending( + this IQueryable values, Expression> orderKeySelector, int page, int take) diff --git a/src/MongODM.Core/FieldDefinition/UnmappedFieldDefinition.cs b/src/MongODM.Core/FieldDefinition/UnmappedFieldDefinition.cs index 326d384..eed87ee 100644 --- a/src/MongODM.Core/FieldDefinition/UnmappedFieldDefinition.cs +++ b/src/MongODM.Core/FieldDefinition/UnmappedFieldDefinition.cs @@ -44,7 +44,7 @@ public UnmappedFieldDefinition( // Methods. public override RenderedFieldDefinition Render(RenderArgs args) => - new(UnmappedFieldDefinitionHelper.BuildFieldPath(BaseDocumentField, UnmappedFieldName, args.DocumentSerializer, args.SerializerRegistry, args.LinqProvider), + new(UnmappedFieldDefinitionHelper.BuildFieldPath(BaseDocumentField, UnmappedFieldName, args.DocumentSerializer, args.SerializerRegistry), UnmappedFieldSerializer); public Type? TryGetBaseDocumentType(IBsonSerializer documentSerializer, IBsonSerializerRegistry serializerRegistry) => @@ -75,7 +75,7 @@ public UnmappedFieldDefinition( // Methods. public override RenderedFieldDefinition Render(RenderArgs args) => - new(UnmappedFieldDefinitionHelper.BuildFieldPath(BaseDocumentField, UnmappedFieldName, args.DocumentSerializer, args.SerializerRegistry, args.LinqProvider), + new(UnmappedFieldDefinitionHelper.BuildFieldPath(BaseDocumentField, UnmappedFieldName, args.DocumentSerializer, args.SerializerRegistry), UnmappedFieldSerializer, UnmappedFieldSerializer, UnmappedFieldSerializer); @@ -90,13 +90,12 @@ public static string BuildFieldPath( FieldDefinition? baseDocumentField, string fieldName, IBsonSerializer documentSerializer, - IBsonSerializerRegistry serializerRegistry, - LinqProvider linqProvider) + IBsonSerializerRegistry serializerRegistry) { var sb = new StringBuilder(); if (baseDocumentField is not null) { - var baseDocRenderedField = baseDocumentField.Render(new(documentSerializer, serializerRegistry, linqProvider)); + var baseDocRenderedField = baseDocumentField.Render(new(documentSerializer, serializerRegistry)); sb.Append(baseDocRenderedField.FieldName); } if (sb.Length > 0) diff --git a/src/MongODM.Core/MongODM.Core.csproj b/src/MongODM.Core/MongODM.Core.csproj index e249196..6efb80a 100644 --- a/src/MongODM.Core/MongODM.Core.csproj +++ b/src/MongODM.Core/MongODM.Core.csproj @@ -26,7 +26,7 @@ - + all diff --git a/src/MongODM.Core/Repositories/IRepository.cs b/src/MongODM.Core/Repositories/IRepository.cs index 0540b7d..edd2d9e 100644 --- a/src/MongODM.Core/Repositories/IRepository.cs +++ b/src/MongODM.Core/Repositories/IRepository.cs @@ -13,10 +13,10 @@ // If not, see . using Etherna.MongoDB.Driver; -using Etherna.MongoDB.Driver.Linq; using Etherna.MongODM.Core.Domain.Models; using System; using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; @@ -120,11 +120,11 @@ Task DeleteAsync( CancellationToken cancellationToken = default); Task QueryElementsAsync( - Func, Task> query, + Func, Task> query, AggregateOptions? aggregateOptions = null); Task> QueryPaginatedElementsAsync( - Func, IMongoQueryable> filter, + Func, IQueryable> filter, Expression> orderKeySelector, int page, int take, diff --git a/src/MongODM.Core/Repositories/Repository.cs b/src/MongODM.Core/Repositories/Repository.cs index 95a1665..60b4b7c 100644 --- a/src/MongODM.Core/Repositories/Repository.cs +++ b/src/MongODM.Core/Repositories/Repository.cs @@ -291,7 +291,7 @@ public string ModelIdToString(object model) } public virtual Task QueryElementsAsync( - Func, Task> query, + Func, Task> query, AggregateOptions? aggregateOptions = null) => AccessToCollectionAsync(collection => { @@ -305,7 +305,7 @@ public virtual Task QueryElementsAsync( }); public async Task> QueryPaginatedElementsAsync( - Func, IMongoQueryable> filter, + Func, IQueryable> filter, Expression> orderKeySelector, int page, int take, diff --git a/src/MongODM.Core/Utility/DbMigrationManager.cs b/src/MongODM.Core/Utility/DbMigrationManager.cs index 30c747e..1f1e140 100644 --- a/src/MongODM.Core/Utility/DbMigrationManager.cs +++ b/src/MongODM.Core/Utility/DbMigrationManager.cs @@ -12,7 +12,6 @@ // You should have received a copy of the GNU Lesser General Public License along with MongODM. // If not, see . -using Etherna.MongoDB.Driver; using Etherna.MongoDB.Driver.Linq; using Etherna.MongODM.Core.Domain.Models; using Etherna.MongODM.Core.Extensions; @@ -20,6 +19,7 @@ using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; namespace Etherna.MongODM.Core.Utility