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

Getters in manually implemented get-set properties are not translated

Open AntonC9018 opened this issue 1 year ago • 1 comments

My use case is that I want to effectively add an alias for a member. So here for example I add an Id property which just points to DocumentId. I need the getter of Id to be projectable for it to get translated correctly in queries, but I also happen to need a setter (it's implementing an interface). I cannot separate out the two, because if an interface defines a property as get; set; you have to implement both in one go.

        [NotMapped] public string Id { [Projectable] get => DocumentId; set => DocumentId = value; }
        public string DocumentId { get; set; }

For reference, the id comes from an interface like this:

interface IId<T>
{
    T Id { get; set; }
}

I do need both get and set in the interface and I can't separate them out.

AntonC9018 avatar Jun 22 '23 07:06 AntonC9018

This sounds like a source generation issue and/or a runtime resolution issue and should be relatively easy to fix. Happy to take a PR here.

koenbeuk avatar Jun 26 '23 00:06 koenbeuk