Overriding dynamic providers in G9

 

Hello!

I am just checking, will overriding dynamic providers still work in G9, or should something be changed before it works? I am asking because I can't get anything to run at all, VS will show that the DLL are loaded but the initializer is never called.

Look at this small snippet of overriding ProjectSelectionDynamicProvider.

[ArchiveProvider(ProjectSelectionDynamicProvider.ProviderName, Priority.DynamicSelection)]
public class ProjectSelectionDynamicProviderOverride : ProjectSelectionDynamicProvider
{
    private SearchRestrictionHelper AdwSearch;

    public ProjectSelectionDynamicProviderOverride()
    {
        AdwSearch = new SearchRestrictionHelper(SearchType.DynamicSelection, SearchArea.Projects);
        foreach (ArchiveColumnInfo col in AdwSearch.AvailableColumns)
            AddAvailableColumn(col);
    }

RE: Overriding dynamic providers in G9

Hi Martin,

I think you are assuming SuperOffice 9.2 uses the legacy selection providers, but that is not the case... 

Please read about the SuperOffice Find API to learn more about how selections have changed.

Best regards.

Af: Tony Yates 12. feb 2021

RE: Overriding dynamic providers in G9

Thanks for the quick response!

I was assume you hadn't removed the feature for overriding because it worked niicely.

So if I read the document correct it will not be possible to add your own fields that is shown inside SuperOffice GUI, not yet at least? 

Was this communicated at some point to the community? I would like to read any and all about this decision.

Af: Martin Andersen 12. feb 2021

RE: Overriding dynamic providers in G9

Hi Martin,

You are assuming way too much... They are still just archive providers will the same behavior as all providers.

Best regards.

Af: Tony Yates 12. feb 2021

RE: Overriding dynamic providers in G9

I don't understand you right now.

Will the feature with overriding e.g. a projectselectiondynamic provider work still? 

Maybe I am in the wrong forum? I have a DLL which is loaded through the DynamicLoad section in the web.config. Then the added columns will be shown in the GUI of SuperOffice (only web now but also in Windows 8.5 and before). And as I said, the VS shows all the right bells and whistles but the entry point is never invoked.

Af: Martin Andersen 12. feb 2021

RE: Overriding dynamic providers in G9

Hi Martin,

Yes, there appears to be some miscommunication. Let's try and fix that. 

Your topic heading is "Overriding dynamic providers in G9", which means v9.2. So that is why I referenced that article which discusses how SuperOffice G9 changed all Selection providers and unified the Selection and Find search API's. 

Now you mention Windows 8.5, which obviously is not SuperOffice G9. So now I am confused.

Can you provide all of the context for which concerns your situation?

Af: Tony Yates 12. feb 2021

RE: Overriding dynamic providers in G9

I was mentioning that the dynamic load in the old days, ALSO was available in Windows versions of SuperOffice.

Now I am trying to explain that I am having a “plug-in” that is loaded in the dynamic load section. See the two added DLL's at the end of the DynamicLoad node.

<Factory>
  <DynamicLoad>
	<add key="DefaultSoMail" value="C:\SuperOffice\Web9.2R03\bin\SoMail.dll" />
	<add key="DCFImpl" value="SuperOffice.DCF.Services.Implementation.dll" />
	<add key="MessagingImpl" value="SuperOffice.Messaging.Services.Implementation.dll" />
	<add key="CRMWeb" value="SuperOffice.CRMWeb.dll" />
	<add key="Scripting" value="SuperOffice.Scripting.dll" />
	<add key="QuoteConnector" value="SuperOffice.QuoteConnector.dll" />
	<add key="SmResources" value="SuperOffice.SM.Resources.dll" />
	<!-- Add custom plugins etc here -->
	<add key="AdwizaLists" value="AdwizaLists.dll" />
	<add key="AdwizaSearches" value="AdwizaSearches.dll" />
  </DynamicLoad>
</Factory>

The purpose of the plug-in is to extend (please don’t think SuperOffice Extender or something, it is an English word) or “add to” the GUI. And I mean the GUI of selections, dynamic selections more precises.

The way to do this was to override the providers and add some columns. Now the columns added will show up in the criteria column list. And if you have enabled it, the column also shows in the result columns and can be selected to be shown or not shown. Se this picture with the "New" search.

So what I am asking is, will this still work? Also see the more complete overriding below. It will now show all the code that searches by using SQL and adding to the result, that SuperOffice in the end, will show inside SuperOffice dynamic selections.

[ArchiveProvider(ProjectSelectionDynamicProvider.ProviderName, Priority.DynamicSelection)]
public class ProjectSelectionDynamicProviderOverride : ProjectSelectionDynamicProvider
{
    private SearchRestrictionHelper AdwSearch;

    public ProjectSelectionDynamicProviderOverride()
    {
        AdwSearch = new SearchRestrictionHelper(SearchType.DynamicSelection, SearchArea.Projects);
        foreach (ArchiveColumnInfo col in AdwSearch.AvailableColumns)
            AddAvailableColumn(col);
    }

    public override void SetDesiredColumns(params string[] columnIds)
    {
        base.SetDesiredColumns(columnIds);
        AdwSearch.OrgColumnsIds = columnIds;
        AdwSearch.MakeSearchResult();
    }

    public override bool SetRestriction(params ArchiveRestrictionInfo[] restrictions)
    {
        bool baseResult = base.SetRestriction(restrictions);
        AdwSearch.MakeDynamicSelectionSearchRestrictions(restrictions);
        AdwSearch.MakeSearchResult();
        return baseResult;
    }

    protected override void InnerPopulateRowFromReader(SuperOffice.Data.SoDataReader reader, ArchiveRow row)
    {
        base.InnerPopulateRowFromReader(reader, row);
        if (AdwSearch.AnyColumnSelected)
            AdwSearch.PopulateRow(row);
    }

    protected override bool AcceptRow(SuperOffice.Data.SoDataReader reader)
    {
        bool result = base.AcceptRow(reader);
        if (result)
            result = AdwSearch.AcceptRow(reader);
        return result;
    }
}
Af: Martin Andersen 12. feb 2021

RE: Overriding dynamic providers in G9

Hi Martin,

Right, so I have to go back and recommend you read the SuperOffice Find API article, and it will point out that SuperOffice uses new selection providers. That's why I recommeded you read it in the first place, and discover that on your own. 

The recommended way to add new fields to providers has been to create ExtenderExtenders, not override the provider itself. But, yes, there may be rare cases where a complete swap might be desired. However, just adding "Other" to the drop down list to see your new fields are not one of them... you get that with ExtenderExtenders.

Marek provided some good implementation details here has well, so if you are interested to know more of the underlying details, it might be interesting to review those.

However, it seems you just want to be told with what you should replace in your code to make it work, and nevermind reading more about it. So if that is the case... the new ProjectSelectionDynamicProvider is a class called, ProjectSelectionDynamicProviderV2 , and is named ProjectDynamicSelectionV2.

You really still should read up on the new API though, to gain a better understanding how the entire Selection system works with CriteriaGroups and more these days.

Good luck, and best regards!

Af: Tony Yates 12. feb 2021

RE: Overriding dynamic providers in G9

OK. Still when I read this it doen't say anything about adding columns, only how to use the find from your own code? But maybe I am wrong.

I will tried to use the V2, the new way, maybe it is an easy swap for my old code.

Or Extenders is the way. 

Af: Martin Andersen 12. feb 2021