Hi folks!
I have a CRUD service that is accessed in an api controller, and this is wired up by Umbraco by DI (I found an example here).
But now I need to use the CRUD service outside of this context, but I am fairly lost how to inject the IScopeProvider "manually" or in some kind of composer.
Any help/hints appreciated! (Before I revert to ol' PetaPoco in a separate project...)
you should be able to use the scope without DI like below
using (var scope = Current.ScopeProvider.CreateScope(autoComplete: true))
{
var database = scope.Database;
var result = database.Query<ConfigData>("SELECT * FROM VantageConfig WHERE C_NAME=@0", fieldname).FirstOrDefault();
return result != null;
}
DI without DI...
Hi folks! I have a CRUD service that is accessed in an api controller, and this is wired up by Umbraco by DI (I found an example here).
But now I need to use the CRUD service outside of this context, but I am fairly lost how to inject the IScopeProvider "manually" or in some kind of composer.
Any help/hints appreciated! (Before I revert to ol' PetaPoco in a separate project...)
you should be able to use the scope without DI like below
Hi, Current is not available in Umbraco 11. How would I access it there?
Ahh... It sits on "Currnet" - great!
Välkommen till Umbraco 8 Ulf! ;) <3
* L O L *
is working on a reply...