private void SubscribeToEvents(IEnumerable <CacheDependentEntry> dependentEntities)
        {
            foreach (var dependentEntry in dependentEntities)
            {
                if (dependentEntry.Operations.HasFlag(CacheDependentOperations.Add))
                {
                    DataEventSystemFacade.SubscribeToDataAfterAdd(dependentEntry.EntityType, ResetCache, true);
                }

                if (dependentEntry.Operations.HasFlag(CacheDependentOperations.Update))
                {
                    DataEventSystemFacade.SubscribeToDataAfterUpdate(dependentEntry.EntityType, ResetCache, true);
                }

                if (dependentEntry.Operations.HasFlag(CacheDependentOperations.Deleted))
                {
                    DataEventSystemFacade.SubscribeToDataDeleted(dependentEntry.EntityType, ResetCache, true);
                }

                if (dependentEntry.Operations > 0)
                {
                    DataEventSystemFacade.SubscribeToStoreChanged(dependentEntry.EntityType, ResetCacheOnUnhandledChange, true);
                }
            }
        }
Beispiel #2
0
 private static void SubscribeToEvents()
 {
     DataEventSystemFacade.SubscribeToDataAfterUpdate <IUserPermissionDefinition>(OnUserPermissionChanged, true);
     DataEventSystemFacade.SubscribeToDataAfterAdd <IUserPermissionDefinition>(OnUserPermissionChanged, true);
     DataEventSystemFacade.SubscribeToDataDeleted <IUserPermissionDefinition>(OnUserPermissionChanged, true);
     DataEventSystemFacade.SubscribeToStoreChanged <IUserPermissionDefinition>(OnUserPermissionStoreChanged, true);
 }
Beispiel #3
0
        public TransformCache()
        {
            DataEventSystemFacade.SubscribeToDataAfterAdd <IMediaFile>(OnDataChanged, true);
//			DataEventSystemFacade.SubscribeToDataAfterMove<IMediaFile>(OnDataChanged);
            DataEventSystemFacade.SubscribeToDataBeforeUpdate <IMediaFile>(OnDataChanged, true);
            DataEventSystemFacade.SubscribeToDataDeleted <IMediaFile>(OnDataChanged, true);
        }
 static UserSettingsImpl()
 {
     DataEventSystemFacade.SubscribeToDataAfterAdd <IUserSettings>(OnUserSettingsChanged, true);
     DataEventSystemFacade.SubscribeToDataAfterUpdate <IUserSettings>(OnUserSettingsChanged, true);
     DataEventSystemFacade.SubscribeToDataDeleted <IUserSettings>(OnUserSettingsChanged, true);
     DataEventSystemFacade.SubscribeToStoreChanged <IUserSettings>(OnUserStoreChanged, true);
 }
Beispiel #5
0
 static DataBasedUserGroupPermissionDefinitionProvider()
 {
     DataEventSystemFacade.SubscribeToDataAfterUpdate <IUserGroupPermissionDefinition>(OnUserGroupPermissionChanged, true);
     DataEventSystemFacade.SubscribeToDataAfterAdd <IUserGroupPermissionDefinition>(OnUserGroupPermissionChanged, true);
     DataEventSystemFacade.SubscribeToDataDeleted <IUserGroupPermissionDefinition>(OnUserGroupPermissionChanged, true);
     DataEventSystemFacade.SubscribeToStoreChanged <IUserGroupPermissionDefinition>(OnUserGroupPermissionStoreChanged, true);
 }
        public QueryCache(string name, Expression <Func <TDataType, TPropertyType> > propertyGetter, int size)
        {
            _innerCache     = new Cache <string, ExtendedNullable <TDataType> >(name, size);
            _propertyGetter = propertyGetter;

            DataEventSystemFacade.SubscribeToDataAfterAdd <TDataType>(OnDataChanged, true);
            DataEventSystemFacade.SubscribeToDataAfterUpdate <TDataType>(OnDataChanged, true);
            DataEventSystemFacade.SubscribeToDataDeleted <TDataType>(OnDataChanged, true);

            _typeIsLocalizable = DataLocalizationFacade.IsLocalized(typeof(TDataType));
        }
Beispiel #7
0
        public static void OnInitialized()
        {
            DataEventSystemFacade.SubscribeToDataBeforeUpdate <Entries>(BlogFacade.SetTitleUrl, true);
            DataEventSystemFacade.SubscribeToDataBeforeAdd <Entries>(BlogFacade.SetTitleUrl, true);

            DataEventSystemFacade.SubscribeToDataAfterAdd <Entries>(BlogFacade.ClearRssFeedCache, true);
            DataEventSystemFacade.SubscribeToDataAfterUpdate <Entries>(BlogFacade.ClearRssFeedCache, true);
            DataEventSystemFacade.SubscribeToDataDeleted <Entries>(BlogFacade.ClearRssFeedCache, true);

            DataUrls.RegisterGlobalDataUrlMapper <Entries>(new BlogEntryDataUrlMapper());
            UrlToEntityTokenFacade.Register(new BlogUrlToEntityTokenMapper());
        }
        public DataHookMapper(EntityToken parentEntityToken)
        {
            if (parentEntityToken == null)
            {
                throw new ArgumentNullException("parentEntityToken");
            }

            DataEventSystemFacade.SubscribeToDataAfterAdd <T>(OnDataAddedOrDeleted, false);
            DataEventSystemFacade.SubscribeToDataDeleted <T>(OnDataAddedOrDeleted, false);
            DataEventSystemFacade.SubscribeToStoreChanged <T>(OnStoreChanged, false);

            this.ParentEntityToken = parentEntityToken;
        }
        public void Start()
        {
            DataEventSystemFacade.SubscribeToDataAfterAdd(_interfaceType,
                                                          (sender, args) => CatchAll(() => GetActionContainer().Add(() => Data_OnAfterAdd(sender, args))),
                                                          true);

            DataEventSystemFacade.SubscribeToDataAfterUpdate(_interfaceType,
                                                             (sender, args) => CatchAll(() => GetActionContainer().Add(() => Data_OnAfterUpdate(sender, args))),
                                                             true);

            DataEventSystemFacade.SubscribeToDataDeleted(_interfaceType,
                                                         (sender, args) => CatchAll(() => GetActionContainer().Add(() => Data_OnDeleted(sender, args))),
                                                         true);
        }
Beispiel #10
0
        private static void SubscribeToDataEvents()
        {
            DataEvents <IPage> .OnAfterAdd += SitemapUpdateAfterPageChanged;
            DataEvents <IPage> .OnDeleted  += SitemapUpdateAfterPageChanged;

            foreach (var typeFullName in _dataTypesToIncludeFromConfig)
            {
                var type = Type.GetType(typeFullName);
                if (type == null)
                {
                    continue;
                }

                DataEventSystemFacade.SubscribeToDataAfterAdd(type, SitemapUpdateAfterPageChanged, true);
                DataEventSystemFacade.SubscribeToDataDeleted(type, SitemapUpdateAfterPageChanged, true);
            }
        }
        public void Initialize()
        {
            using (_resourceLocker.Locker)
            {
                if (!GlobalInitializerFacade.IsReinitializingTheSystem)
                {
                    DataEventSystemFacade.SubscribeToDataAfterAdd <IDataItemTreeAttachmentPoint>(OnUpdateTreeAttachmentPoints, true);
                    DataEventSystemFacade.SubscribeToDataDeleted <IDataItemTreeAttachmentPoint>(OnUpdateTreeAttachmentPoints, true);
                    DataEventSystemFacade.SubscribeToStoreChanged <IDataItemTreeAttachmentPoint>(OnTreeAttachmentPointsStoreChange, true);

                    GeneratedTypesFacade.SubscribeToUpdateTypeEvent(OnDataTypeChanged);

                    var treeAuxiliaryAncestorProvider = new C1Console.Trees.TreeAuxiliaryAncestorProvider();
                    AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider <TreeSimpleElementEntityToken>(treeAuxiliaryAncestorProvider, true);
                    AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider <TreeFunctionElementGeneratorEntityToken>(treeAuxiliaryAncestorProvider, true);
                    AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider <TreeDataFieldGroupingElementEntityToken>(treeAuxiliaryAncestorProvider, true);
                    AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider <DataEntityToken>(treeAuxiliaryAncestorProvider, true);
                    AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider <TreePerspectiveEntityToken>(treeAuxiliaryAncestorProvider, true);

                    _resourceLocker.Resources.PersistentAttachmentPoints = new Dictionary <string, List <IAttachmentPoint> >();

                    LoadAllTrees();
                    InitializeTreeAttachmentPoints();
                    TreeSharedRootsFacade.Clear();

                    var fileWatcher = new C1FileSystemWatcher(TreeDefinitionsFolder, "*.xml");
                    fileWatcher.Created            += OnReloadTrees;
                    fileWatcher.Deleted            += OnReloadTrees;
                    fileWatcher.Changed            += OnReloadTrees;
                    fileWatcher.Renamed            += OnReloadTrees;
                    fileWatcher.EnableRaisingEvents = true;

                    _resourceLocker.Resources.FileSystemWatcher = fileWatcher;


                    _resourceLocker.Resources.RootEntityToken = ElementFacade.GetRootsWithNoSecurity().First().ElementHandle.EntityToken;
                }
            }
        }
        public static void Initialize()
        {
            ServiceBusListener.Register(new CommonEventMessageProcessor()
            {
                EventName = "ProductUpdatedEvent",
                Action    = SitemapGeneratorScheduler.RegenerateSitemapJob
            });
            ServiceBusListener.Start();

            DataEvents <IPage> .OnAfterAdd += new DataEventHandler(SitemapUpdateAfterPageChanged);
            DataEvents <IPage> .OnDeleted  += new DataEventHandler(SitemapUpdateAfterPageChanged);

            foreach (var typeFullName in _dataTypesToIncludeFromConfig)
            {
                var type = Type.GetType(typeFullName);
                if (type == null)
                {
                    continue;
                }

                DataEventSystemFacade.SubscribeToDataAfterAdd(type, SitemapUpdateAfterPageChanged, true);
                DataEventSystemFacade.SubscribeToDataDeleted(type, SitemapUpdateAfterPageChanged, true);
            }
        }
Beispiel #13
0
 public FavoriteFunctionsProvider()
 {
     DataEventSystemFacade.SubscribeToDataAfterAdd <IFavoriteFunction>(OnDataChanged, false);
     DataEventSystemFacade.SubscribeToDataDeleted <IFavoriteFunction>(OnDataChanged, false);
 }