Rebranded to EntityFrameworkCore.Projectables

This commit is contained in:
Koen Bekkenutte
2021-05-31 21:27:17 +08:00
parent e3eda6be69
commit 300aab0767
89 changed files with 141 additions and 141 deletions

View File

@@ -12,10 +12,10 @@
<PropertyGroup>
<Authors>Koen Bekkenutte</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projections</PackageProjectUrl>
<RepositoryUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projections.git</RepositoryUrl>
<PackageProjectUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projectables</PackageProjectUrl>
<RepositoryUrl>https://github.com/koenbeuk/EntityFrameworkCore.Projectables.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>https://github.com/koenbeuk/EntityFrameworkCore.Projections/releases</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/koenbeuk/EntityFrameworkCore.Projectables/releases</PackageReleaseNotes>
</PropertyGroup>
</Project>

View File

@@ -7,9 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A43F1828-D9B
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F5E4436F-87F2-46AB-A9EB-59B4BF21BF7A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projections.Generator", "src\EntityFrameworkCore.Projections.Generator\EntityFrameworkCore.Projections.Generator.csproj", "{698E3EEC-64F9-4F96-B700-D61D04FD0704}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.Generator", "src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj", "{698E3EEC-64F9-4F96-B700-D61D04FD0704}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projections.Generator.Tests", "tests\EntityFrameworkCore.Projections.Generator.Tests\EntityFrameworkCore.Projections.Generator.Tests.csproj", "{20F85652-2923-4211-9262-C64BA8C9ED89}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.Generator.Tests", "tests\EntityFrameworkCore.Projectables.Generator.Tests\EntityFrameworkCore.Projectables.Generator.Tests.csproj", "{20F85652-2923-4211-9262-C64BA8C9ED89}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7B02E555-9633-4522-8C20-AD93C713C9AE}"
ProjectSection(SolutionItems) = preProject
@@ -17,17 +17,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projections", "src\EntityFrameworkCore.Projections\EntityFrameworkCore.Projections.csproj", "{EE4D6CC1-78DE-4279-A567-C3D360C479F8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables", "src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj", "{EE4D6CC1-78DE-4279-A567-C3D360C479F8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{07584D01-2D30-404B-B0D1-32080C0CC18A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicSample", "samples\BasicSample\BasicSample.csproj", "{1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projections.Abstractions", "src\EntityFrameworkCore.Projections.Abstractions\EntityFrameworkCore.Projections.Abstractions.csproj", "{C8038180-36F8-4077-922B-91F428EAC7D9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.Abstractions", "src\EntityFrameworkCore.Projectables.Abstractions\EntityFrameworkCore.Projectables.Abstractions.csproj", "{C8038180-36F8-4077-922B-91F428EAC7D9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projections.Tests", "tests\EntityFrameworkCore.Projections.Tests\EntityFrameworkCore.Projections.Tests.csproj", "{2F0DD7D7-867F-4478-9E22-45C114B61C46}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.Tests", "tests\EntityFrameworkCore.Projectables.Tests\EntityFrameworkCore.Projectables.Tests.csproj", "{2F0DD7D7-867F-4478-9E22-45C114B61C46}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projections.FunctionalTests", "tests\EntityFrameworkCore.Projections.FunctionalTests\EntityFrameworkCore.Projections.FunctionalTests.csproj", "{A36F5471-0C16-4453-811B-818326931313}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.FunctionalTests", "tests\EntityFrameworkCore.Projectables.FunctionalTests\EntityFrameworkCore.Projectables.FunctionalTests.csproj", "{A36F5471-0C16-4453-811B-818326931313}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadmeSample", "samples\ReadmeSample\ReadmeSample.csproj", "{6F63E04C-9267-4211-8AC7-290C60331D60}"
EndProject

View File

@@ -1,15 +1,15 @@
> DISCLAIMER: This project and this readme in particular are still a WIP. Expect a first version coming coon.
> DISCLAIMER: The final name of this project has not yet been settled upon. EntityFrameworkCore.Projections is quite non descriptive as projections are a core concept of EFCore already. Feel free to open up an issue suggesting a better name
> DISCLAIMER: The final name of this project has not yet been settled upon. EntityFrameworkCore.Projectables is quite non descriptive as Projectables are a core concept of EFCore already. Feel free to open up an issue suggesting a better name
# EntitiyFrameworkCore.Projections
# EntitiyFrameworkCore.Projectables
Flexible projection magic for EFCore
[![NuGet version (EntityFrameworkCore.Projections)](https://img.shields.io/nuget/v/EntityFrameworkCore.Projections.Abstractions.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projections.Abstractions/)
[![NuGet version (EntityFrameworkCore.Projectables)](https://img.shields.io/nuget/v/EntityFrameworkCore.Projectables.Abstractions.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projectables.Abstractions/)
## NuGet packages
- EntityFrameworkCore.Projections.Abstractions [![NuGet version](https://img.shields.io/nuget/v/EntityFrameworkCore.Projections.Abstractions.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projections.Abstractions/) [![NuGet](https://img.shields.io/nuget/dt/EntityFrameworkCore.Projections.Abstractions.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projections.Abstractions/)
- EntityFrameworkCore.Projections [![NuGet version](https://img.shields.io/nuget/v/EntityFrameworkCore.Projections.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projections/) [![NuGet](https://img.shields.io/nuget/dt/EntityFrameworkCore.Projections.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projections/)
- EntityFrameworkCore.Projectables.Abstractions [![NuGet version](https://img.shields.io/nuget/v/EntityFrameworkCore.Projectables.Abstractions.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projectables.Abstractions/) [![NuGet](https://img.shields.io/nuget/dt/EntityFrameworkCore.Projectables.Abstractions.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projectables.Abstractions/)
- EntityFrameworkCore.Projectables [![NuGet version](https://img.shields.io/nuget/v/EntityFrameworkCore.Projectables.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projectables/) [![NuGet](https://img.shields.io/nuget/dt/EntityFrameworkCore.Projectables.svg?style=flat-square)](https://www.nuget.org/packages/EntityFrameworkCore.Projectables/)
## Getting started
TODO
@@ -99,7 +99,7 @@ There is currently no support for overloaded methods. Each method name needs to
No; The runtime component injects itself within the EFCore query compilation pipeline and thus has no impact on the database provider used. Of course you're still limited to whatever your database provider can do.
#### Are there performance implications that I should be aware of?
Yes and no; using EntityFrameworkCore.Projections does not add any measerable overhead on top of normal use of EFCore (Expect a proper benchmark soon...) however it does make it easier to write more complex queries. As such: Always consider the generated SQL and ensure that it's performance implications are acceptable.
Yes and no; using EntityFrameworkCore.Projectables does not add any measerable overhead on top of normal use of EFCore (Expect a proper benchmark soon...) however it does make it easier to write more complex queries. As such: Always consider the generated SQL and ensure that it's performance implications are acceptable.
#### Can I call additional properties and methods from my Projectable properties and methods?
Yes you can! Any projectable property/method can call into other properties and methods as long as those properties/methods are native to EFCore or as long as they are marked with a `Projectable` attribute.
@@ -116,7 +116,7 @@ Any call to squared given any int will perfertly translate to SQL.
Expressionify is a project that was launched before this project. It has some overlapping features and uses similar approaches. When I first published this project, I was not aware of its existance so shame on me. Currently Expressionify targets a more focusses scope of what this project is doing and thereby it seems to be more limiting in its capabilities. Check them out though!
#### How does this relate to LinqKit/LinqExpander/...?
There are a few projects like [LinqKit](https://github.com/scottksmith95/LINQKit) that were created before we had code generators in dotnet. These are great options if you're stuck with classical EF or don't want to rely on code generation. Otherwise I would suggest that EntityFrameworkCore.Projections and Expresssionify are superior approaches as they are able to rely on SourceGenerators to do most of the hard work.
There are a few projects like [LinqKit](https://github.com/scottksmith95/LINQKit) that were created before we had code generators in dotnet. These are great options if you're stuck with classical EF or don't want to rely on code generation. Otherwise I would suggest that EntityFrameworkCore.Projectables and Expresssionify are superior approaches as they are able to rely on SourceGenerators to do most of the hard work.
#### Is the available for EFCore 3.1, 5 and 6?
Yes it is! there is no difference between any of these versions and you can upgrade/downgrade whenever you want.

View File

@@ -16,8 +16,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections.Generator\EntityFrameworkCore.Projections.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections\EntityFrameworkCore.Projections.csproj" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,5 @@
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projections.Extensions;
using EntityFrameworkCore.Projectables;
using EntityFrameworkCore.Projectables.Extensions;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
@@ -95,7 +95,7 @@ namespace BasicSample
.AddDbContext<ApplicationDbContext>(options => {
options
.UseSqlite(dbConnection)
.UseProjections()
.UseProjectables()
.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
})
.BuildServiceProvider();

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Extensions;
using EntityFrameworkCore.Projectables.Extensions;
using Microsoft.EntityFrameworkCore;
using ReadmeSample.Entities;
@@ -19,7 +19,7 @@ namespace ReadmeSample
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=ReadmeSample;Trusted_Connection=True");
optionsBuilder.UseProjections();
optionsBuilder.UseProjectables();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace ReadmeSample.Entities
{

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using ReadmeSample.Entities;
namespace ReadmeSample.Extensions

View File

@@ -16,8 +16,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections.Generator\EntityFrameworkCore.Projections.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections\EntityFrameworkCore.Projections.csproj" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
</ItemGroup>
</Project>

View File

@@ -2,11 +2,11 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>EntityFrameworkCore.Projections</RootNamespace>
<RootNamespace>EntityFrameworkCore.Projectables</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EntityFrameworkCore.Projections.Generator\EntityFrameworkCore.Projections.Generator.csproj" Pack="false">
<ProjectReference Include="..\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" Pack="false">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -15,7 +15,7 @@
<ItemGroup>
<!-- Package the generator in the analyzer directory of the nuget package -->
<None Include="$(OutputPath)\EntityFrameworkCore.Projections.Generator.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\EntityFrameworkCore.Projectables.Generator.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
</ItemGroup>
</Project>

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections
namespace EntityFrameworkCore.Projectables
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
public sealed class ProjectableAttribute : Attribute

View File

@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
namespace EntityFrameworkCore.Projections.Generator
namespace EntityFrameworkCore.Projectables.Generator
{
public static class Diagnostics
{

View File

@@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\EntityFrameworkCore.Projections\Services\ProjectionExpressionClassNameGenerator.cs" Link="ProjectionExpressionClassNameGenerator.cs" />
<Compile Include="..\EntityFrameworkCore.Projectables\Services\ProjectionExpressionClassNameGenerator.cs" Link="ProjectionExpressionClassNameGenerator.cs" />
</ItemGroup>
<ItemGroup>

View File

@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Generator
namespace EntityFrameworkCore.Projectables.Generator
{
public class ExpressionSyntaxRewriter : CSharpSyntaxRewriter

View File

@@ -4,7 +4,7 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace EntityFrameworkCore.Projections.Generator
namespace EntityFrameworkCore.Projectables.Generator
{
public class ParameterSyntaxRewriter : CSharpSyntaxRewriter
{

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Generator
namespace EntityFrameworkCore.Projectables.Generator
{
public class ProjectableDescriptor
{

View File

@@ -4,7 +4,7 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace EntityFrameworkCore.Projections.Generator
namespace EntityFrameworkCore.Projectables.Generator
{
public static class ProjectableInterpreter
{
@@ -32,7 +32,7 @@ namespace EntityFrameworkCore.Projections.Generator
}
var projectableAttributeTypeSymbol = context.Compilation.GetTypeByMetadataName("EntityFrameworkCore.Projections.ProjectableAttribute");
var projectableAttributeTypeSymbol = context.Compilation.GetTypeByMetadataName("EntityFrameworkCore.Projectables.ProjectableAttribute");
var projectableAttributeClass = memberSymbol.GetAttributes()
.Where(x => x.AttributeClass.Name == "ProjectableAttribute")

View File

@@ -1,4 +1,4 @@
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.Services;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
@@ -10,7 +10,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Generator
namespace EntityFrameworkCore.Projectables.Generator
{
[Generator]
public class ProjectionExpressionGenerator : ISourceGenerator
@@ -67,7 +67,7 @@ namespace EntityFrameworkCore.Projections.Generator
);
resultBuilder.Append($@"
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{{
public static class {generatedClassName}

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Generator
namespace EntityFrameworkCore.Projectables.Generator
{
public class SyntaxReceiver : ISyntaxReceiver
{

View File

@@ -9,7 +9,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EntityFrameworkCore.Projections.Abstractions\EntityFrameworkCore.Projections.Abstractions.csproj" />
<ProjectReference Include="..\EntityFrameworkCore.Projectables.Abstractions\EntityFrameworkCore.Projectables.Abstractions.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
using EntityFrameworkCore.Projections.Infrastructure.Internal;
using EntityFrameworkCore.Projectables.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using System;
@@ -8,15 +8,15 @@ using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Extensions
namespace EntityFrameworkCore.Projectables.Extensions
{
public static class DbContextOptionsExtensions
{
public static DbContextOptionsBuilder<TContext> UseProjections<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder)
public static DbContextOptionsBuilder<TContext> UseProjectables<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder)
where TContext : DbContext
=> (DbContextOptionsBuilder<TContext>)UseProjections((DbContextOptionsBuilder)optionsBuilder);
=> (DbContextOptionsBuilder<TContext>)UseProjectables((DbContextOptionsBuilder)optionsBuilder);
public static DbContextOptionsBuilder UseProjections(this DbContextOptionsBuilder optionsBuilder)
public static DbContextOptionsBuilder UseProjectables(this DbContextOptionsBuilder optionsBuilder)
{
var extension = optionsBuilder.Options.FindExtension<ProjectionOptionsExtension>() ?? new ProjectionOptionsExtension();
((IDbContextOptionsBuilderInfrastructure)optionsBuilder).AddOrUpdateExtension(extension);

View File

@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Extensions
namespace EntityFrameworkCore.Projectables.Extensions
{
public static class TypeExtensions
{

View File

@@ -4,10 +4,10 @@ using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.Services;
using Microsoft.EntityFrameworkCore.Query;
namespace EntityFrameworkCore.Projections.Infrastructure.Internal
namespace EntityFrameworkCore.Projectables.Infrastructure.Internal
{
public class CustomQueryTranslationPreprocessorFactory : IQueryTranslationPreprocessorFactory
{

View File

@@ -10,7 +10,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Infrastructure.Internal
namespace EntityFrameworkCore.Projectables.Infrastructure.Internal
{
public class ProjectionOptionsExtension : IDbContextOptionsExtension
{

View File

@@ -5,7 +5,7 @@ using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Services
namespace EntityFrameworkCore.Projectables.Services
{
public sealed class ExpressionArgumentReplacer : ExpressionVisitor
{

View File

@@ -1,7 +1,7 @@
using System.Linq.Expressions;
using System.Reflection;
namespace EntityFrameworkCore.Projections.Services
namespace EntityFrameworkCore.Projectables.Services
{
public interface IProjectionExpressionResolver
{

View File

@@ -5,7 +5,7 @@ using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Services
namespace EntityFrameworkCore.Projectables.Services
{
public sealed class ProjectableExpressionReplacer : ExpressionVisitor
{

View File

@@ -4,11 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFrameworkCore.Projections.Services
namespace EntityFrameworkCore.Projectables.Services
{
public static class ProjectionExpressionClassNameGenerator
{
public const string Namespace = "EntityFrameworkCore.Projections.Generated";
public const string Namespace = "EntityFrameworkCore.Projectables.Generated";
public static string GenerateName(string? namespaceName, IEnumerable<string> nestedInClassNames, string memberName)
{

View File

@@ -6,9 +6,9 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Extensions;
using EntityFrameworkCore.Projectables.Extensions;
namespace EntityFrameworkCore.Projections.Services
namespace EntityFrameworkCore.Projectables.Services
{
public sealed class ProjectionExpressionResolver : IProjectionExpressionResolver
{

View File

@@ -4,8 +4,8 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.Services;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
@@ -13,7 +13,7 @@ using Xunit;
#nullable disable
namespace EntityFrameworkCore.Projections.FunctionalTests
namespace EntityFrameworkCore.Projectables.FunctionalTests
{
[UsesVerify]
@@ -29,13 +29,13 @@ namespace EntityFrameworkCore.Projections.FunctionalTests
// todo: since Order is a nested class, we currently have to fully express the location of this class
[Projectable]
public EntityFrameworkCore.Projections.FunctionalTests.ComplexModelTests.Order LastOrder =>
public EntityFrameworkCore.Projectables.FunctionalTests.ComplexModelTests.Order LastOrder =>
Orders.OrderByDescending(x => x.RecordDate).FirstOrDefault();
// todo: since Order is a nested class, we currently have to fully express the location of this class
[Projectable]
[NotMapped]
public IEnumerable<EntityFrameworkCore.Projections.FunctionalTests.ComplexModelTests.Order> Last2Orders =>
public IEnumerable<EntityFrameworkCore.Projectables.FunctionalTests.ComplexModelTests.Order> Last2Orders =>
Orders.OrderByDescending(x => x.RecordDate).Take(2);
}

View File

@@ -29,8 +29,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections.Generator\EntityFrameworkCore.Projections.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections\EntityFrameworkCore.Projections.csproj" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
namespace EntityFrameworkCore.Projections.FunctionalTests.ExtensionMethods
namespace EntityFrameworkCore.Projectables.FunctionalTests.ExtensionMethods
{
public class Entity
{

View File

@@ -1,4 +1,4 @@
namespace EntityFrameworkCore.Projections.FunctionalTests.ExtensionMethods
namespace EntityFrameworkCore.Projectables.FunctionalTests.ExtensionMethods
{
public static class EntityExtensions
{

View File

@@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projections.FunctionalTests.ExtensionMethods
namespace EntityFrameworkCore.Projectables.FunctionalTests.ExtensionMethods
{
[UsesVerify]

View File

@@ -4,10 +4,10 @@ using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Extensions;
using EntityFrameworkCore.Projectables.Extensions;
using Microsoft.EntityFrameworkCore;
namespace EntityFrameworkCore.Projections.FunctionalTests.Helpers
namespace EntityFrameworkCore.Projectables.FunctionalTests.Helpers
{
public class SampleDbContext<TEntity> : DbContext
where TEntity : class
@@ -15,7 +15,7 @@ namespace EntityFrameworkCore.Projections.FunctionalTests.Helpers
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=(localdb)\v11.0;Integrated Security=true"); // Fake connection string as we're actually never connecting
optionsBuilder.UseProjections();
optionsBuilder.UseProjectables();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)

View File

@@ -4,14 +4,14 @@ using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.Services;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projections.FunctionalTests
namespace EntityFrameworkCore.Projectables.FunctionalTests
{
[UsesVerify]
public class StatefullComplexFunctionTests

View File

@@ -4,13 +4,13 @@ using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projections.FunctionalTests
namespace EntityFrameworkCore.Projectables.FunctionalTests
{
[UsesVerify]
public class StatefullPropertyTests

View File

@@ -4,13 +4,13 @@ using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projections.FunctionalTests
namespace EntityFrameworkCore.Projectables.FunctionalTests
{
[UsesVerify]
public class StatefullSimpleFunctionTests

View File

@@ -4,14 +4,14 @@ using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.Services;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projections.FunctionalTests
namespace EntityFrameworkCore.Projectables.FunctionalTests
{
[UsesVerify]
public class StatelessComplexFunctionTests

View File

@@ -4,13 +4,13 @@ using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projections.FunctionalTests
namespace EntityFrameworkCore.Projectables.FunctionalTests
{
[UsesVerify]
public class StatelessPropertyTests

View File

@@ -4,13 +4,13 @@ using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.FunctionalTests.Helpers;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using Microsoft.EntityFrameworkCore;
using ScenarioTests;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projections.FunctionalTests
namespace EntityFrameworkCore.Projectables.FunctionalTests
{
[UsesVerify]
public class StatelessSimpleFunctionTests

View File

@@ -29,8 +29,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections.Generator\EntityFrameworkCore.Projections.Generator.csproj" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections\EntityFrameworkCore.Projections.csproj" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,9 +1,9 @@
using System;
using System.Linq;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,9 +1,9 @@
using System;
using System.Linq;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,9 +1,9 @@
using System;
using System.Linq;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_D_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -1,8 +1,8 @@
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projections.Generated
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_C_Foo

View File

@@ -8,7 +8,7 @@ using VerifyXunit;
using Xunit;
using Xunit.Abstractions;
namespace EntityFrameworkCore.Projections.Generator.Tests
namespace EntityFrameworkCore.Projectables.Generator.Tests
{
[UsesVerify]
public class ProjectionExpressionGeneratorTests
@@ -38,7 +38,7 @@ class C { }
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
[Projectable]
@@ -60,7 +60,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
[Projectable]
@@ -81,7 +81,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
public int Bar { get; set; }
@@ -105,7 +105,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
class D {
@@ -131,7 +131,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
public int Bar { get; set; }
@@ -155,7 +155,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
public int Bar() => 1;
@@ -180,7 +180,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
public int Bar { get; set; }
@@ -204,7 +204,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
[Projectable]
@@ -226,7 +226,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
[Projectable]
@@ -248,7 +248,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
[Projectable]
@@ -271,7 +271,7 @@ namespace Foo {
var compilation = CreateCompilation(@"
using System;
using System.Linq;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class D { }
@@ -298,7 +298,7 @@ namespace Foo {
var compilation = CreateCompilation(@"
using System;
using System.Linq;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class D { }
@@ -323,7 +323,7 @@ namespace Foo {
var compilation = CreateCompilation(@"
using System;
using System.Linq;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
static class C {
[Projectable]
@@ -345,7 +345,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
[Projectable]
@@ -367,7 +367,7 @@ namespace Foo {
{
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projections;
using EntityFrameworkCore.Projectables;
namespace Foo {
class C {
[Projectable]

View File

@@ -20,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projections\EntityFrameworkCore.Projections.csproj" />
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
</ItemGroup>
</Project>

View File

@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Extensions;
using EntityFrameworkCore.Projectables.Extensions;
using Xunit;
namespace EntityFrameworkCore.Projections.Tests.Extensions
namespace EntityFrameworkCore.Projectables.Tests.Extensions
{
public class TypeExtensionTests
{

View File

@@ -4,10 +4,10 @@ using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.Services;
using Xunit;
namespace EntityFrameworkCore.Projections.Tests.Services
namespace EntityFrameworkCore.Projectables.Tests.Services
{
public class ExpressionArgumentReplacerTests
{

View File

@@ -5,10 +5,10 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.Services;
using Xunit;
namespace EntityFrameworkCore.Projections.Tests.Services
namespace EntityFrameworkCore.Projectables.Tests.Services
{
public class ProjectableExpressionReplacerTests
{

View File

@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projections.Services;
using EntityFrameworkCore.Projectables.Services;
using Xunit;
namespace EntityFrameworkCore.Projections.Tests.Services
namespace EntityFrameworkCore.Projectables.Tests.Services
{
public class ProjectionExpressionClassNameGeneratorTests
{

View File

@@ -6,7 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace EntityFrameworkCore.Projections.Tests.Services
namespace EntityFrameworkCore.Projectables.Tests.Services
{
public class ProjectionExpressionResolverTests
{