public static bool AnyIndexes(object obj, LuceneOperation operation) { if (obj == null) { return(false); } return (IndexDefinitionTypes.Any( definition => definition.GetUpdateTypes(operation).Any(type => type.IsAssignableFrom(obj.GetType())))); }
public List<LuceneAction> GetAllActions(object entity, LuceneOperation operation) { if (!(entity is SystemEntity)) return new List<LuceneAction>(); var systemEntity = entity as SystemEntity; var actionsDictionary = GetActionsDictionary(operation); var luceneActions = new List<LuceneAction>(); foreach (var action in actionsDictionary.Keys.SelectMany(key => actionsDictionary[key])) { luceneActions.AddRange(action(systemEntity)); } return luceneActions; }
public List <LuceneAction> GetAllActions(object entity, LuceneOperation operation) { if (!(entity is SystemEntity)) { return(new List <LuceneAction>()); } var systemEntity = entity as SystemEntity; var actionsDictionary = GetActionsDictionary(operation); var luceneActions = new List <LuceneAction>(); foreach (var action in actionsDictionary.Keys.SelectMany(key => actionsDictionary[key])) { luceneActions.AddRange(action(systemEntity)); } return(luceneActions); }
public List <LuceneAction> GetAllActions(object entity, LuceneOperation operation) { if (!(entity is SystemEntity)) { return(new List <LuceneAction>()); } SystemEntity systemEntity = entity as SystemEntity; Dictionary <Type, List <Func <SystemEntity, IEnumerable <LuceneAction> > > > actionsDictionary = GetActionsDictionary(operation); List <LuceneAction> luceneActions = new List <LuceneAction>(); foreach (Func <SystemEntity, IEnumerable <LuceneAction> > action in actionsDictionary.Keys.SelectMany(key => actionsDictionary[key])) { luceneActions.AddRange(action(systemEntity)); } return(luceneActions); }
public static void QueueTask(Type type, SiteEntity siteEntity, LuceneOperation operation) { if (IndexingHelper.AnyIndexes(siteEntity, operation)) { var info = new QueuedTaskInfo { Data = siteEntity.Id.ToString(), Type = type.MakeGenericType(siteEntity.GetType()), SiteId = siteEntity.Site.Id }; if (!CurrentRequestData.OnEndRequest.OfType <AddLuceneTaskInfo>().Any(task => info.Equals(task.Data))) { CurrentRequestData.OnEndRequest.Add(new AddLuceneTaskInfo(info)); } } }
public abstract Dictionary <Type, List <Func <SystemEntity, IEnumerable <LuceneAction> > > > GetActionsDictionary( LuceneOperation operation);
public abstract IEnumerable <Type> GetUpdateTypes(LuceneOperation operation);
public abstract Dictionary<Type, List<Func<SystemEntity, IEnumerable<LuceneAction>>>> GetActionsDictionary( LuceneOperation operation);
public abstract IEnumerable<Type> GetUpdateTypes(LuceneOperation operation);