Skip to content

DbFunctions: instance functions on entities #9811

@divega

Description

@divega

Consider the scenario originally described at #9213 (comment) (about why instance functions on DbContext can be compelling):

db.Posts.Where(p => db.PostReadCount(p.Id) > 5);

It could actually be even more compelling to be able to do this:

db.Posts.Where(p => p.ReadCount() > 5);

This could work for instance methods, computed properties or even extension method defined over the entity type.

It would be convenient for the translation to automatically map the "this" entity instance to the key of the entity when invoking the database implementation of the function.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions