-
-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make IDocumentSchemaProvider accessible from IMartenQueryable #3543
Comments
@cafour Any reason why you're not just using the AdvancedSql API that already does a lot of that? |
@jeremydmiller I did experiment with it but realized that by using it, I lose the comfort of composing an |
Okay, I'll buy that. I think I'd look for more usable alternatives though. Maybe a |
Or alternatively, have some kind of markup in the SQL that gets resolved by Marten at the time the SQL is compiled. The underlying codegen has something like that and that's been helpful |
@jeremydmiller The |
This is pretty much just a small quality-of-life improvement.
That being said, I'd like to be able to access
IDocumentSchemaProvider
from within extension methods that extendIQueryable
and mix LINQ functions with raw SQL. Best shown with an example:The extension method above applies a where clause that filters documents of type
T
based on whether a user withaccountId
has the correct permission flags for each of the documents. To do this, it needs to access documents of typeEntityPermissionInfo
. The type's table doesn't necessarily have to be in thepublic
schema, so we have to useIDocumentSchemaResolver.For
.Right now, we pass the resolver each time we call the method, which is a bit cumbersome. Especially if I consider that Marten's queryable has a reference to a query session, from which one can navigate to the schema resolver.
The easiest thing to do would be to just make
IMartenLinqQueryable
public, then I could just check if the queryable implements it and use the query session within. I'm fine with making a PR for it, but I have no idea if it would break anything else, so I'm opening this issue instead.The text was updated successfully, but these errors were encountered: