diff --git a/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs b/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs index 9eb5984..88057d5 100644 --- a/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs +++ b/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs @@ -13,10 +13,16 @@ namespace Microsoft.EntityFrameworkCore { public static class DbContextOptionsExtensions { + /// + /// Use projectables within the queries. Any call to a Projectable property/method will automatically be translated to the underlying expression tree instead + /// public static DbContextOptionsBuilder UseProjectables(this DbContextOptionsBuilder optionsBuilder, Action? configure = null) where TContext : DbContext => (DbContextOptionsBuilder)UseProjectables((DbContextOptionsBuilder)optionsBuilder, configure); + /// + /// Use projectables within the queries. Any call to a Projectable property/method will automatically be translated to the underlying expression tree instead + /// public static DbContextOptionsBuilder UseProjectables(this DbContextOptionsBuilder optionsBuilder, Action? configure = null) { var extension = optionsBuilder.Options.FindExtension() ?? new ProjectionOptionsExtension(); diff --git a/src/EntityFrameworkCore.Projectables/Extensions/ExpressionExtensions.cs b/src/EntityFrameworkCore.Projectables/Extensions/ExpressionExtensions.cs index 0d91dca..36878a2 100644 --- a/src/EntityFrameworkCore.Projectables/Extensions/ExpressionExtensions.cs +++ b/src/EntityFrameworkCore.Projectables/Extensions/ExpressionExtensions.cs @@ -16,6 +16,9 @@ namespace EntityFrameworkCore.Projectables.Extensions public static Expression ExpandQuaryables(this Expression expression) => ExpandProjectables(expression); + /// + /// Replaces all calls to properties and methods that are marked with the Projectable attribute with their respective expression tree + /// public static Expression ExpandProjectables(this Expression expression) => _projectableExpressionReplacer.Visit(expression); } diff --git a/src/EntityFrameworkCore.Projectables/Extensions/QueryableExtensions.cs b/src/EntityFrameworkCore.Projectables/Extensions/QueryableExtensions.cs index 710dad0..4be751b 100644 --- a/src/EntityFrameworkCore.Projectables/Extensions/QueryableExtensions.cs +++ b/src/EntityFrameworkCore.Projectables/Extensions/QueryableExtensions.cs @@ -13,6 +13,9 @@ namespace EntityFrameworkCore.Projectables.Extensions public static IQueryable ExpandQuaryables(this IQueryable query) => ExpandProjectables(query); + /// + /// Replaces all calls to properties and methods that are marked with the Projectable attribute with their respective expression tree + /// public static IQueryable ExpandProjectables(this IQueryable query) => query.Provider.CreateQuery(query.Expression.ExpandProjectables()); } diff --git a/src/EntityFrameworkCore.Projectables/Infrastructure/CompatibilityMode.cs b/src/EntityFrameworkCore.Projectables/Infrastructure/CompatibilityMode.cs index 54217a0..4e95022 100644 --- a/src/EntityFrameworkCore.Projectables/Infrastructure/CompatibilityMode.cs +++ b/src/EntityFrameworkCore.Projectables/Infrastructure/CompatibilityMode.cs @@ -8,7 +8,15 @@ namespace EntityFrameworkCore.Projectables.Infrastructure { public enum CompatibilityMode { + /// + /// Projectables are expanded on each individual query invocation. + /// This mode can be used when you wan't to pass scoped services to your Projectable methods + /// Full, + /// + /// Projectables are expanded in the query preprocessor and afterwards cached. + /// This is the default compatibility mode. + /// Limited } } diff --git a/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs b/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs index d7a3668..697a6e5 100644 --- a/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs +++ b/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs @@ -18,6 +18,9 @@ namespace EntityFrameworkCore.Projectables.Infrastructure _optionsBuilder = optionsBuilder ?? throw new ArgumentNullException(nameof(optionsBuilder)); } + /// + /// Change the default CompatibilityMode + /// public ProjectableOptionsBuilder CompatibilityMode(CompatibilityMode mode) => WithOption(x => x.WithCompatibilityMode(mode));