Skip to main content

This is the first time i deal with custom validations, but I need to create a unique email validation using sitecore 9.0.2 and sxaSXA 1.7.1 so i was following this tutorial

http://sitecoresolution.blogspot.com/2018/04/sitecore-9-forms-server-validation-email-already-exists.html

but i have a problem with this method:

protected virtual IFormDataProvider FormDataProvider
    {
        get
        {
            IFormDataProvider formDataProvider = this._dataProvider;
            if (formDataProvider == null)
            {
                IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();
                IFormDataProvider formDataProvider1 = service;
                this._dataProvider = service;
                formDataProvider = formDataProvider1;
            }
            return formDataProvider;
        }
    }

specifically this line:

IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();

saying that:

'IServiceProvider' does not contain a definition for 'GetService' and the best extension method overload 'DependencyResolverExtensions.GetService(IDependencyResolver)' requires a receiver of type 'IDependencyResolver'

'IServiceProvider' does not contain a definition for 'GetService' and the best extension method overload 'DependencyResolverExtensions.GetService(IDependencyResolver)' requires a receiver of type 'IDependencyResolver'

Any ideas what might be the cause ?

This is the first time i deal with custom validations, but I need to create a unique email validation using sitecore 9.0.2 and sxa 1.7.1 so i was following this tutorial

http://sitecoresolution.blogspot.com/2018/04/sitecore-9-forms-server-validation-email-already-exists.html

but i have a problem with this method

protected virtual IFormDataProvider FormDataProvider
    {
        get
        {
            IFormDataProvider formDataProvider = this._dataProvider;
            if (formDataProvider == null)
            {
                IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();
                IFormDataProvider formDataProvider1 = service;
                this._dataProvider = service;
                formDataProvider = formDataProvider1;
            }
            return formDataProvider;
        }
    }

specifically this line

IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();

saying that

'IServiceProvider' does not contain a definition for 'GetService' and the best extension method overload 'DependencyResolverExtensions.GetService(IDependencyResolver)' requires a receiver of type 'IDependencyResolver'

Any ideas what might be the cause ?

This is the first time i deal with custom validations, but I need to create a unique email validation using sitecore 9.0.2 and SXA 1.7.1 so i was following this tutorial

http://sitecoresolution.blogspot.com/2018/04/sitecore-9-forms-server-validation-email-already-exists.html

but i have a problem with this method:

protected virtual IFormDataProvider FormDataProvider
    {
        get
        {
            IFormDataProvider formDataProvider = this._dataProvider;
            if (formDataProvider == null)
            {
                IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();
                IFormDataProvider formDataProvider1 = service;
                this._dataProvider = service;
                formDataProvider = formDataProvider1;
            }
            return formDataProvider;
        }
    }

specifically this line:

IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();

saying that:

'IServiceProvider' does not contain a definition for 'GetService' and the best extension method overload 'DependencyResolverExtensions.GetService(IDependencyResolver)' requires a receiver of type 'IDependencyResolver'

Any ideas what might be the cause ?

Source Link

'IServiceProvider' does not contain a definition for 'GetService'

This is the first time i deal with custom validations, but I need to create a unique email validation using sitecore 9.0.2 and sxa 1.7.1 so i was following this tutorial

http://sitecoresolution.blogspot.com/2018/04/sitecore-9-forms-server-validation-email-already-exists.html

but i have a problem with this method

protected virtual IFormDataProvider FormDataProvider
    {
        get
        {
            IFormDataProvider formDataProvider = this._dataProvider;
            if (formDataProvider == null)
            {
                IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();
                IFormDataProvider formDataProvider1 = service;
                this._dataProvider = service;
                formDataProvider = formDataProvider1;
            }
            return formDataProvider;
        }
    }

specifically this line

IFormDataProvider service = ServiceLocator.ServiceProvider.GetService<IFormDataProvider>();

saying that

'IServiceProvider' does not contain a definition for 'GetService' and the best extension method overload 'DependencyResolverExtensions.GetService(IDependencyResolver)' requires a receiver of type 'IDependencyResolver'

Any ideas what might be the cause ?