Пример #1
0
        /// <summary>
        /// Ensures VisitorGroupContentProviderModels are removed from the datastore, if the underlying VisitorGroup has been removed
        /// </summary>
        internal void RemoveModelsWithUnknownVisitorGroup()
        {
            var groupStore = new VisitorGroupStore();
            IEnumerable <VisitorGroupContentProviderModel> allSavedModels = ContentProviderService.GetAllModels();

            foreach (var contentProviderModel in allSavedModels)
            {
                VisitorGroup group = groupStore.Load(contentProviderModel.VisitorGroupId);
                if (group == null)
                {
                    ContentProviderService.Delete(contentProviderModel.Id.ExternalId);
                }
            }
        }