EntityFrameworkCore.Projectables icon indicating copy to clipboard operation
EntityFrameworkCore.Projectables copied to clipboard

Fluent option?

Open relfman-cmg opened this issue 2 years ago • 4 comments

Is it possible to have a fluent option instead of using attributes? It would be nice if I could set this in the entity configuration on the EntityTypeBuilder

builder.Projectable(...)

relfman-cmg avatar Dec 09 '23 23:12 relfman-cmg

+1 Something like this — that is, being able to mark a property as projectable from the 'outside' — is actually very much needed in onion/clean architecture type projects.

I'm not sure if a fluent builder could work since this is a source generator; if not, then an [assembly: ProjectableAt(typeof(Person), nameof(Person.FullName))] attribute may be a good API.

aradalvand avatar Jun 19 '24 06:06 aradalvand

being able to mark a property as projectable from the 'outside' — is actually very much needed

This library needs access to the syntax when it generates a companion expression. Anything that lives on the outside does not come with Syntax. EntityFrameworkCore.Projectables.Abstractions has no reference to EFCore and exists for that reason. You can reference it in your abstraction projects and mark things as Projectable as needed`

koenbeuk avatar Aug 18 '24 23:08 koenbeuk

Anything that lives on the outside does not come with Syntax.

Yeah you're actually right, fair enough.

EntityFrameworkCore.Projectables.Abstractions has no reference to EFCore and exists for that reason.

There would still be a conceptual dependency on EF though, so kind of a leaky abstraction.

aradalvand avatar Aug 19 '24 06:08 aradalvand