Example #1
0
        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))
            };
        }
Example #3
0
        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))
            };
        }
Example #4
0
 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));
 }