public static void AddPropertySetter <TEntity, TController>(this ResourceMapping <TEntity, TController> resourceMapping, string key, Expression <Action <TEntity, object> > expression) { var convertedExpression = ExpressionUtils.ConvertToObjectTypeExpression(expression); resourceMapping.PropertySettersExpressions.Add(key, convertedExpression); resourceMapping.PropertySetters.Add(key, convertedExpression.Compile()); }
public ResourceConfigurationBuilder(ConfigurationBuilder configurationBuilder) { ResourceTypeConvention = configurationBuilder.GetConvention <IResourceTypeConvention>(); LinkNameConvention = configurationBuilder.GetConvention <ILinkNameConvention>(); LinkIdConvention = configurationBuilder.GetConvention <ILinkIdConvention>(); PropertyScanningConvention = configurationBuilder.GetConvention <IPropertyScanningConvention>(); BuiltResourceMapping = new ResourceMapping <TResource, TController> { ResourceType = ResourceTypeConvention.GetResourceTypeFromRepresentationType(typeof(TResource)) }; }
public ResourceConfigurationBuilder(ConfigurationBuilder configurationBuilder) { ConfigurationBuilder = configurationBuilder; ResourceTypeConvention = configurationBuilder.GetConvention <IResourceTypeConvention>(); LinkNameConvention = configurationBuilder.GetConvention <ILinkNameConvention>(); LinkIdConvention = configurationBuilder.GetConvention <ILinkIdConvention>(); PropertyScanningConvention = configurationBuilder.GetConvention <IPropertyScanningConvention>(); ConstructedMetadata = new ResourceMapping <TResource> { ResourceType = ResourceTypeConvention.GetResourceTypeFromRepresentationType(typeof(TResource)) }; }
public static void AddPropertyGetter <TEntity, TController>(this ResourceMapping <TEntity, TController> resourceMapping, string key, Expression <Func <TEntity, object> > expression) { resourceMapping.PropertyGetters.Add(key, ExpressionUtils.CompileToObjectTypedFunction(expression)); }