Esempio n. 1
0
        private List <ScheduledJob> GetGhostJobs(IScheduledJobRepository scheduledJobRepository)
        {
            var scheduledJobs = PlugInLocator.Search(new ScheduledPlugInAttribute());

            var scheduledJobDescriptors = PlugInDescriptor.GetAttributeArray(
                scheduledJobs,
                typeof(ScheduledPlugInAttribute));

            var ghostJobs =
                (from job in scheduledJobRepository.List()
                 let attribute = scheduledJobDescriptors.FirstOrDefault(x =>
                                                                        string.Equals(x.PlugInType.FullName, job.TypeName, StringComparison.InvariantCultureIgnoreCase))
                                 select new ScheduledJob
            {
                Id = job.ID,
                FromCode = attribute != null,
                Name = job.Name,
                AssemblyName = job.AssemblyName
            })
                .Where(x => !x.FromCode)
                .ToList();

            return(ghostJobs);
        }