Try our conversational search powered by Generative AI!

Override DefaultTypeNameConvention

Vote:
 

I have created my own ITypeNameConvention class, and have created an initialization module to set the Convention on the current search client.  I can see in the debugger that my Initialization module is executing successfully, and I can see that searchcClient.Conventions.TypeNameConvention holds my custom class -- yet when the client service is injected in another block of code, its TypeNameConvention has switched back to Default.  How to I ensure that my class is used instead of the default?

	[InitializableModule]
	[ModuleDependency(typeof(FrameworkInitializationModule))]
	public class FindInitialization : IConfigurableModule
	{
		public void ConfigureContainer(ServiceConfigurationContext context)
		{
			
		}

		public void Initialize(InitializationEngine context)
		{
			var searchClient = ServiceLocator.Current.GetInstance();
			
			var typeNameMapper = new CdnTypeNameMapper();
			searchClient.Conventions.TypeNameConvention = typeNameMapper;
		}

		public void Uninitialize(InitializationEngine context)
		{
		}

	}
}
#181097
Aug 09, 2017 2:09
* 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.