/// <summary>
        ///     Include specified method to resulting typing.
        ///     User <see cref="Ts.Parameter{T}()" /> to mock up method parameters or specify configuration for perticular method
        ///     parameter
        /// </summary>
        /// <param name="tc">Configuration builder</param>
        /// <param name="method">Method to include</param>
        /// <param name="configuration">Configuration to be applied to method</param>
        /// <returns>Fluent</returns>
        public static ClassConfigurationBuilder <T> WithMethod <T>(this ClassConfigurationBuilder <T> tc,
                                                                   Expression <Action <T> > method, Action <MethodExportConfiguration> configuration)
        {
            tc.WithMethods(new[] { LambdaHelpers.ParseMethodLambda(method) }, configuration);
            ITypeConfigurationBuilder tcb = tc;

            ExtractParameters(tcb, method);
            return(tc);
        }
        /// <summary>
        ///     Include specified method to resulting typing.
        ///     User <see cref="Ts.Parameter{T}()" /> to mock up method parameters or specify configuration for perticular method
        ///     parameter
        /// </summary>
        /// <param name="tc">Configuration builder</param>
        /// <param name="method">Method to include</param>
        /// <param name="configuration">configuration to be applied to method</param>
        /// <returns>Fluent</returns>
        public static InterfaceConfigurationBuilder <T> WithMethod <T, TData>(this InterfaceConfigurationBuilder <T> tc,
                                                                              Expression <Func <T, TData> > method, Action <MethodConfigurationBuilder> configuration)
        {
            tc.WithMethods(new[] { LambdaHelpers.ParseMethodLambda(method) }, configuration);
            ITypeConfigurationBuilder tcb = tc;

            ExtractParameters(tcb, method);
            return(tc);
        }
        /// <summary>
        ///     Include specified method to resulting typing.
        ///     User <see cref="Ts.Parameter{T}()" /> to mock up method parameters or specify configuration for perticular method
        ///     parameter
        /// </summary>
        /// <param name="tc">Configuration builder</param>
        /// <param name="method">Method to include</param>
        /// <returns>Fluent</returns>
        public static MethodExportBuilder WithMethod <T>(this ITypedExportBuilder <T> tc,
                                                         Expression <Action <T> > method)
        {
            var prop = LambdaHelpers.ParseMethodLambda(method);
            ClassOrInterfaceExportBuilder tcb = tc as ClassOrInterfaceExportBuilder;
            var methodConf = new MethodExportBuilder(tcb.Blueprint, prop);

            tcb.ExtractParameters(method);
            return(methodConf);
        }
        /// <summary>
        ///     Include specified method to resulting typing.
        ///     User <see cref="Ts.Parameter{T}()" /> to mock up method parameters or specify configuration for perticular method
        ///     parameter
        /// </summary>
        /// <param name="tc">Configuration builder</param>
        /// <param name="method">Method to include</param>
        /// <returns>Fluent</returns>
        public static MethodConfigurationBuilder WithMethod <T>(this TypeConfigurationBuilder <T> tc,
                                                                Expression <Action <T> > method)
        {
            var prop = LambdaHelpers.ParseMethodLambda(method);
            ITypeConfigurationBuilder tcb = tc;
            var methodConf = new MethodConfigurationBuilder(prop, tc._blueprint);

            ExtractParameters(tcb, method);
            return(methodConf);
        }
        /// <summary>
        ///     Include specified method to resulting typing.
        ///     User <see cref="Ts.Parameter{T}()" /> to mock up method parameters or specify configuration for perticular method
        ///     parameter
        /// </summary>
        /// <param name="tc">Configuration builder</param>
        /// <param name="method">Method to include</param>
        /// <returns>Fluent</returns>
        public static MethodExportConfiguration WithMethod <T>(this TypeConfigurationBuilder <T> tc,
                                                               Expression <Action <T> > method)
        {
            var prop = LambdaHelpers.ParseMethodLambda(method);
            ITypeConfigurationBuilder tcb = tc;
            var methodConf =
                (MethodExportConfiguration)
                tcb.MembersConfiguration.GetOrCreate(prop, () => new MethodExportConfiguration());

            ExtractParameters(tcb, method);
            return(methodConf);
        }
        static Ts()
        {
            Expression <Func <object> > lambda = () => Parameter <object>(a => a.Ignore());

            ParametrizedParameterMethod = LambdaHelpers.ParseMethodLambda(lambda).GetGenericMethodDefinition();
        }
Exemplo n.º 7
0
 /// <summary>
 ///     Include specified method to resulting typing.
 ///     User <see cref="Ts.Parameter{T}()" /> to mock up method parameters or specify configuration for perticular method
 ///     parameter
 /// </summary>
 /// <param name="method">Method to include</param>
 /// <param name="configuration">configuration to be applied to method</param>
 /// <returns>Fluent</returns>
 public ClassExportBuilder <T> WithMethod(Expression <Action <T> > method, Action <MethodExportBuilder> configuration)
 {
     WithMethods(new[] { LambdaHelpers.ParseMethodLambda(method) }, configuration);
     ExtractParameters(method);
     return(this);
 }
 /// <summary>
 ///     Include specified method to resulting typing.
 ///     User <see cref="Ts.Parameter{T}()" /> to mock up method parameters or specify configuration for perticular method
 ///     parameter
 /// </summary>
 /// <param name="method">Method to include</param>
 /// <param name="configuration">configuration to be applied to method</param>
 /// <returns>Fluent</returns>
 public InterfaceExportBuilder <T> WithMethod <TData>(Expression <Func <T, TData> > method, Action <MethodExportBuilder> configuration)
 {
     this.WithMethods(new[] { LambdaHelpers.ParseMethodLambda(method) }, configuration);
     ExtractParameters(method);
     return(this);
 }