예제 #1
0
        /// <summary>
        /// The next.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <returns>
        /// The <see cref="T"/>.
        /// </returns>
        public override T Next(IGenerationContext context)
        {
            // TODO: May actually create a parallel set of interfaces for doing non-generic requests to session
            // This would negate the need for that awful reflection
            object[] args = this.constructorInfo.GetParameters().Select(
                x =>
            {
                MethodInfo method = context.GetType().GetMethod("Next", Type.EmptyTypes);
                MethodInfo target = method.MakeGenericMethod(x.ParameterType);
                return(target.Invoke(context, null));
            }).ToArray();

            return((T)this.constructorInfo.Invoke(args));
        }