Try our conversational search powered by Generative AI!

Upgrading to 11 - new way of registering UIDescriptors?

Vote:
 

 

When I upgraded to version 11.3 I get the following error due to an obsolete method while registering my UIDescriptors:

 

public Injected UiDescriptorRegistry;

UiDescriptorRegistry.Service.Add(new UIDescriptor(typeof(IDefaultAllPropertiesView)) {DefaultView = CmsViewNames.AllPropertiesView});

 

The obsolete method error message is as follows:

Error CS1929 'UIDescriptorRegistry' does not contain a definition for 'Add' and the best extension method overload 'ServiceConfigurationProviderExtensions.Add(IServiceConfigurationProvider, ServiceDescriptor)' requires a receiver of type 'IServiceConfigurationProvider' 

 

However, when I follow this guide and use the recommend implementation I get another exception, this is my code:

 

ServiceConfigurationProvider.Service.Add(new ServiceDescriptor(typeof(UIDescriptor), new UIDescriptor(typeof(IDefaultAllPropertiesView)) { DefaultView = CmsViewNames.AllPropertiesView }));

 

So it seems like I don't have the implementation of the ServiceConfigurationProvider correct. Since Episerver provides a useful error message but now documentation on how this should be done, is there anyone who monitors this forum who can provide the implementation?

 

Thanks in advance,

Ben 

#187359
Jan 19, 2018 20:39
Vote:
 

Hi Ben! 

Did you find a solution for this? Having the same problem.

Best regards,

Fredrik

#187721
Feb 01, 2018 11:16
Vote:
 

I have not yet! using an implementation that may be a bit old, but doesn't give me warnings. 

I'll post it here, but don't think it's the correct answer according to the obsolete message warning that I'm getting on my original post:

var registry = context.Locate.Advanced.GetInstance<UIDescriptorRegistry>();
registry.UIDescriptors.ToList().Add(new UIDescriptor(typeof(IDefaultAllPropertiesView)) { DefaultView = CmsViewNames.AllPropertiesView });



#187937
Edited, Feb 06, 2018 22:31
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.