I used to be able to access UmbracoForms data with FormStorage() like this:
But when trying to do this in V8 it seems like the accessibility level has been changed and I get the error of "'FormStorage' is inaccessible due to its protection level."
What is the new way of accessing the Forms storage, records data in V8 now?
This means you can gain access to the FormStorage by injecting it into the constructor of the class you are working in:
eg
public class SomeCustomController : UmbracoAuthorizedJsonController
{
private readonly IFormStorage _formStorage;
public SomeCustomController(IFormStorage formStorage)
{
_formStorage = formStorage;
}
Then you can use _formStorage in your methods..
Failing that, eg you are choosing not to use DI, or it would be difficult to implement in your custom code then you can use the service locator pattern to retrieve the instance of IFormStorage:
FormStorage() inaccessible now in Forms for V8?
Hi,
I used to be able to access UmbracoForms data with FormStorage() like this:
But when trying to do this in V8 it seems like the accessibility level has been changed and I get the error of "'FormStorage' is inaccessible due to its protection level."
What is the new way of accessing the Forms storage, records data in V8 now?
Hi Imran
FormStorage is now registered as a singleton with Umbraco V8's new lightject underlying dependency injection framework:
This means you can gain access to the FormStorage by injecting it into the constructor of the class you are working in:
eg
Then you can use _formStorage in your methods..
Failing that, eg you are choosing not to use DI, or it would be difficult to implement in your custom code then you can use the service locator pattern to retrieve the instance of IFormStorage:
regards
Marc
May I ask what that would be in a Razor email template then?
is working on a reply...