Skip to main content
Question

Remove Extension DAC at Runtime

  • 14 September 2023
  • 0 replies
  • 54 views

Hi All,

This is our existing implementation that used work in 2019 version, basically the below piece of code removes an Ext Dac at runtime from the sorted list. We are planning to use the same implementation in 2022 R1 version, only change here is ActivateOnApplicationStart is obsolete in Autofac.For some reason the implementation is not working anymore, any thoughts on how this can be achieved or any better suggestions to implement the same?

namespace MyLib
{
 public class ServiceRegistration : Module 

 { 
 protected override void Load(ContainerBuilder builder)
 {

builder.ActivateOnApplicationStart<ExtensionSorting>(); // 2019 version
 

/*builder.RegisterType(typeof(ExtensionSorting)) 2022 r1
    .PreserveExistingDefaults()
    .InstancePerDependency();*/

 }
 private class ExtensionSorting
 {
     private List<Type> mySort(List<Type> list)
     {
         if (list.Contains(typeof(CRCaseExt)))
         {
             list.Remove(typeof(CRCaseExt));
         }
         list.Sort((t1, t2) => { return t1.FullName.CompareTo(t2.FullName); });
         return list;
     }

     public ExtensionSorting()
     {
         PXBuildManager.SortExtensions += (list) => mySort(list);
     }
 }
 } 
 }
}

Be the first to reply!

Reply