-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTagsTransferModule.cs
More file actions
52 lines (46 loc) · 1.8 KB
/
TagsTransferModule.cs
File metadata and controls
52 lines (46 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Linq;
using EPiServer.Core.Transfer;
using EPiServer.Data;
using EPiServer.Data.Dynamic;
using EPiServer.Enterprise;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using Geta.Tags.Models;
namespace Geta.Tags
{
/// <summary>
/// Module to transfer the robots.txt content to mirrored servers when in a full staging/delivery configuration
/// Source: EPiRobots - http://epirobots.codeplex.com/
/// </summary>
[InitializableModule, ModuleDependency(typeof(DataInitialization)), ModuleDependency(typeof(DynamicDataTransferHandler))]
public class TagsTransferModule : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
DataExporter.Exporting += this.DataExporter_Exporting;
}
public void Uninitialize(InitializationEngine context)
{
DataExporter.Exporting -= this.DataExporter_Exporting;
}
public void Preload(string[] parameters)
{
}
private void DataExporter_Exporting(object sender, EventArgs e)
{
var exporter = sender as DataExporter;
if (exporter != null && exporter.TransferType == TypeOfTransfer.MirroringExporting)
{
var ddsHandler = (sender as DataExporter).TransferHandlers.Where(p => p.GetType() == typeof(DynamicDataTransferHandler)).Single() as DynamicDataTransferHandler;
var store = typeof(Tag).GetStore();
var externalId = store.GetIdentity().ExternalId;
var storeName = store.Name;
if (ddsHandler != null)
{
ddsHandler.AddToExport(externalId, storeName);
}
}
}
}
}