private void SavingChanges(object sender, EventArgs e) { try { foreach ( var brightstarEntityObject in from to in Repository.TrackedObjects where to.Implements <IConfigSet>() select to as IConfigSet) { brightstarEntityObject.Version = $"{DateTime.UtcNow.Year}.{DateTime.UtcNow.Month:D2}.{DateTime.UtcNow.DayOfYear:D3}"; } foreach ( var brightstarEntityObject in from to in Repository.TrackedObjects where to.Implements <IEnvironment>() select to as IEnvironment) { var key = GetCacheKey(brightstarEntityObject.ConfigSet.Id, brightstarEntityObject.Name); ConfigurationSet old; brightstarEntityObject.Version++; ConfigSetCache.TryRemove(key, out old); } } catch (Exception) { // ignored } }
protected void AddToCache(string id, string environment, ConfigurationSet set) { ConfigSetCache.AddOrUpdate(GetCacheKey(id, environment), set); }