TransferModule, DDS and Episerver 10

Vote:
 

I'm working on upgrading one of our modules (Geta.Tags) to support Episerver 10. I'm however a little stuck with this class: https://github.com/Geta/Tags/blob/master/src/TagsTransferModule.cs. Since DataExporter is obsolete we need to use IDataExportEvents instead, but I wasn't able to figure out how line 39 would look:

var ddsHandler = (sender as DataExporter).TransferHandlers.Single(p => p.GetType() == typeof(DynamicDataTransferHandler)) as DynamicDataTransferHandler;

Thanks for any pointers!

Frederik

#171604
Nov 11, 2016 21:58
Vote:
 

I believe that you should be able to cast the sender object to a ITransferHandlerContext instead and access the TransferHandlers from there in the same way that you are currently doing it.

Let us know how you get on!

Henrik

Disclaimer: This suggestion was cooked up without actually trying anything out and it therefore possible that it might fail miserably.

#171613
Nov 13, 2016 10:21
Vote:
 

mm .. good point I'm stuck with similar issue. I got to the point to hook up to "IDataExportEvents.Starting" event of using:

    public class DataExporterContextEventArgs : EventArgs
    {
        public DataExporterContextEventArgs(IDataExporter dataExporter, ITransferHandlerContext context);

        public IDataExporter DataExporter { get; }
        public ITransferHandlerContext TransferHandlerContext { get; }
    }

I used "DataExporter" as before. Works for me but haven't try with Tags!

Aria

#171621
Nov 14, 2016 1:37
Vote:
 

As Henrik is suggesting you should be able to get the DDS trnafer handler from context. Something like:

var ddsHandler = transferHandlerContext.TransferHandlers.OfType<IDynamicDataTransfer>().FirstOrDefault();
#171710
Nov 15, 2016 17:20
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.