public IEnumerable <ReleaseResource> ListReleases(ProjectResource project) { foreach (var release in _server.Repository.Projects.GetReleases(project).Items) { var version = release.Version.ToSemanticVersion(); if (version == null) { _appInsights.TrackEvent("SemanticVersion.ParseError", new Dictionary <string, string> { { "Project", project.Name }, { "Release", release.Version } }); continue; } TrackCacheEvent(CacheKeyType.Release, project.Id + ";" + version.ToNormalizedString(), "Seeded"); yield return(_cache.Set(CacheKey(CacheKeyType.Release, project.Id, version.ToNormalizedString()), release, new MemoryCacheEntryOptions { SlidingExpiration = TimeSpan.FromHours(1) })); } }
public int AddItem(Type type) { appInsights?.TrackEvent($"Add {type.Name}"); var collection = GetCollection(type); var collType = collection.GetType(); var count = (int)collType.GetProperty("Count").GetValue(collection); var item = CreateObject(type); object[] data = { item }; collType.GetMethod("Add").Invoke(collection, data); RaisePropertyChanged(); return(count); }