public static void Configure() { var instanceManager = EngineContext.Current.Resolve <ICommerceInstanceManager>(); // Ensure sqlce db folder for each instances var instances = instanceManager.GetInstances().ToList(); foreach (var instance in instances) { var folder = DataFolders.Instances.GetFolder(instance.Name).GetFolder("Multilingual"); if (!folder.Exists) { folder.Create(); } } // Configure DbConfiguration DbConfiguration.Loaded += DbConfiguration_Loaded; // Register stores foreach (var instance in instances) { LanguageStores.Register(instance.Name, new CachedLanguageStore(new SqlceLanguageStore(instance.Name, instanceManager))); TranslationStores.Register(instance.Name, new CachedTranslactionStore(new SqlceTranslationStore(instance.Name, instanceManager))); } }
public void Handle(CommerceInstanceCreated @event, CommerceInstance instance) { var folder = DataFolders.Instances.GetFolder(@event.Settings.Name).GetFolder("Multilingual"); folder.Create(); var instanceManager = EngineContext.Current.Resolve <ICommerceInstanceManager>(); // Register stores LanguageStores.Register(@event.InstanceName, new CachedLanguageStore(new SqlceLanguageStore(instance.Name, instanceManager))); TranslationStores.Register(@event.InstanceName, new CachedTranslactionStore(new SqlceTranslationStore(instance.Name, instanceManager))); }