public void HandleEvent(EntityChangedEventData <EntityProperty> eventData) { var entityConfig = eventData.Entity?.EntityConfig; if (entityConfig == null) { return; } var cacheKey = $"{entityConfig.Namespace}.{entityConfig.ClassName}"; FullProxyCache.Remove(cacheKey); }
public async Task <Type> BuildDtoFullProxyTypeAsync(Type baseType, DynamicDtoTypeBuildingContext context) { var cacheKey = GetTypeCacheKey(baseType, context); var cachedDtoItem = await FullProxyCache.GetOrDefaultAsync(cacheKey); if (cachedDtoItem != null) { context.Classes = cachedDtoItem.NestedClasses.ToDictionary(i => i.Key, i => i.Value); return(cachedDtoItem.DtoType); } var proxyClassName = GetProxyTypeName(baseType, "FullProxy"); var properties = await GetDynamicPropertiesAsync(baseType, context); if (context.AddFormFieldsProperty && !properties.Any(p => p.PropertyName == nameof(IHasFormFieldsList._formFields))) { properties.Add(new DynamicProperty { PropertyName = nameof(IHasFormFieldsList._formFields), PropertyType = typeof(List <string>) }); } var interfaces = new List <Type>(); if (context.AddFormFieldsProperty) { interfaces.Add(typeof(IHasFormFieldsList)); } var type = await CompileResultTypeAsync(baseType, proxyClassName, interfaces, properties, context); await FullProxyCache.SetAsync(cacheKey, new DynamicDtoProxyCacheItem { DtoType = type, NestedClasses = context.Classes.ToDictionary(i => i.Key, i => i.Value) }); return(type); }