Example #1
0
        public async Task <List <T> > GetTypedJobsAsync <T>() where T : IJob
        {
            List <T> jobs = new List <T>();
            var      keys = await GetAllKeysAsync();

            if (keys != null && keys.Any())
            {
                var assembly = typeof(T).Assembly;
                foreach (var key in keys)
                {
                    StorageResult redisResult = Get(key);
                    if (redisResult != null)
                    {
                        var fullname   = redisResult.Type;
                        var typedEvent = typeof(T).FullName;

                        if (fullname == typedEvent)
                        {
                            var type = assembly.GetType(redisResult.Type, false);
                            var job  = (T)JsonConvert.DeserializeObject((string)redisResult.Data, type);
                            jobs.Add(job);
                        }
                    }
                }
            }

            return(jobs);
        }
Example #2
0
        public async Task <List <T> > GetTypedJobsAsync <T>() where T : IJob
        {
            List <T> jobs = new List <T>();
            var      keys = await GetAllKeysAsync();

            if (keys != null && keys.Any())
            {
                foreach (var key in keys)
                {
                    StorageResult storageResult = Get(key);
                    if (storageResult != null)
                    {
                        var fullname = storageResult.Type;
                        var typedJob = typeof(T).FullName;

                        if (fullname == typedJob)
                        {
                            var job = (T)storageResult.Data;
                            jobs.Add(job);
                        }
                    }
                }
            }

            return(jobs);
        }
Example #3
0
        public async Task <List <IJob> > GetJobsAsync()
        {
            List <IJob> jobs = new List <IJob>();
            var         keys = await GetAllKeysAsync();

            if (keys != null && keys.Any())
            {
                foreach (var key in keys)
                {
                    StorageResult storageResult = Get(key);
                    if (storageResult != null)
                    {
                        var job = (IJob)storageResult.Data;
                        jobs.Add(job);
                    }
                }
            }

            return(jobs);
        }
Example #4
0
        public async Task <List <IJob> > GetJobsAsync()
        {
            List <IJob> jobs = new List <IJob>();
            var         keys = await GetAllKeysAsync();

            if (keys != null && keys.Any())
            {
                foreach (var key in keys)
                {
                    StorageResult redisResult = Get(key);
                    if (redisResult != null)
                    {
                        var type = TryGetType(redisResult.Type);
                        var job  = (IJob)JsonConvert.DeserializeObject((string)redisResult.Data, type);
                        jobs.Add(job);
                    }
                }
            }

            return(jobs);
        }