Beispiel #1
0
        private static IEnumerable <Job> Get(JobRepositoryFactoryContext context, Action <JobCriteria> callback)
        {
            JobCriteria criteria = new JobCriteria
            {
                Identifier = Criteria <Guid> .Nothing,
                Version    = Criteria <int> .Nothing
            };

            Func <JobFileEntry, bool> predicate = entry =>
            {
                return(criteria.Identifier.Is(entry.Identifier) &&
                       criteria.Version.Is(entry.Version));
            };

            callback(criteria);

            foreach (JobFileEntry entry in GetInfo(context.Location, predicate))
            {
                yield return(JobFactory.Create(with =>
                {
                    with.Entry = entry;
                }));
            }
        }
        private static IEnumerable<Job> Get(JobRepositoryFactoryContext context, Action<JobCriteria> callback)
        {
            JobCriteria criteria = new JobCriteria
            {
                Identifier = Criteria<Guid>.Nothing,
                Version = Criteria<int>.Nothing
            };

            Func<JobFileEntry, bool> predicate = entry =>
            {
                return criteria.Identifier.Is(entry.Identifier)
                    && criteria.Version.Is(entry.Version);
            };

            callback(criteria);

            foreach (JobFileEntry entry in GetInfo(context.Location, predicate))
            {
                yield return JobFactory.Create(with =>
                {
                    with.Entry = entry;
                });
            }
        }
Beispiel #3
0
            private new Job Single(Action<JobCriteria> with)
            {
                JobCriteria criteria = new JobCriteria();
                with(criteria);

                return items
                    .Where(x => criteria.Identifier.Is(x.Key.Identifier))
                    .OrderByDescending(x => x.Key.Version)
                    .Select(x => new Job { Header = x.Key, Extract = callback => callback(x.Value) })
                    .SingleOrDefault();
            }