public void Initialize(IHandler handler, CachedObject cachedObject, params KeyValuePair<string, string>[] args) { this.handler = handler; this.cachedObject = cachedObject; this.args = args.ToDictionary(a => a.Key, a => a.Value); }
private CachedObject CacheObject(Culture culture, Object @object) { Class @class = this.handler.Storage.GetRepository<IClassRepository>().WithKey(@object.ClassId); List<CachedProperty> cachedProperties = new List<CachedProperty>(); foreach (Member member in this.handler.Storage.GetRepository<IMemberRepository>().FilteredByClassId(@class.Id)) { if (member.PropertyDataTypeId != null) { Property property = this.handler.Storage.GetRepository<IPropertyRepository>().WithObjectIdAndMemberId(@object.Id, member.Id); cachedProperties.Add(this.CacheProperty(culture, property)); } } List<CachedDataSource> cachedDataSources = new List<CachedDataSource>(); foreach (DataSource dataSource in this.handler.Storage.GetRepository<IDataSourceRepository>().FilteredByClassId(@class.Id)) cachedDataSources.Add(this.CacheDataSource(culture, dataSource)); CachedObject cachedObject = new CachedObject(); cachedObject.ObjectId = @object.Id; cachedObject.ClassId = @class.Id; cachedObject.ClassViewName = @class.ViewName; cachedObject.Url = @object.Url; cachedObject.CultureId = culture.Id; if (cachedProperties.Count != 0) cachedObject.CachedProperties = this.SerializeObject(cachedProperties); if (cachedDataSources.Count != 0) cachedObject.CachedDataSources = this.SerializeObject(cachedDataSources); return cachedObject; }