Пример #1
0
        public static Shaper Create(
            [NotNull] IQuerySource querySource,
            [NotNull] Shaper outerShaper,
            [NotNull] Shaper innerShaper,
            [NotNull] Delegate materializer)
        {
            Check.NotNull(querySource, nameof(querySource));
            Check.NotNull(outerShaper, nameof(outerShaper));
            Check.NotNull(innerShaper, nameof(innerShaper));
            Check.NotNull(materializer, nameof(materializer));

            var compositeShaper
                = (Shaper)_createCompositeShaperMethodInfo
                  .MakeGenericMethod(
                      outerShaper.GetType(),
                      outerShaper.Type,
                      innerShaper.GetType(),
                      innerShaper.Type,
                      materializer.GetMethodInfo().ReturnType)
                  .Invoke(
                      null,
                      new object[]
            {
                querySource,
                outerShaper,
                innerShaper,
                materializer,
                null
            });

            return(compositeShaper);
        }
Пример #2
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public static Shaper Create(
            [NotNull] Shaper originalShaper,
            [NotNull] LambdaExpression materializer)
        {
            Check.NotNull(originalShaper, nameof(originalShaper));
            Check.NotNull(materializer, nameof(materializer));

            materializer
                = Expression.Lambda(
                      materializer.Body,
                      EntityQueryModelVisitor.QueryContextParameter,
                      materializer.Parameters[0]);

            var shaper
                = (Shaper)_createShaperMethodInfo
                  .MakeGenericMethod(
                      originalShaper.GetType(),
                      originalShaper.Type,
                      materializer.ReturnType)
                  .Invoke(
                      null,
                      new object[]
            {
                originalShaper,
                materializer.Compile()
            });

            return(shaper);
        }
Пример #3
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public static Shaper Create(
            [NotNull] IQuerySource querySource,
            [NotNull] Shaper outerShaper,
            [NotNull] Shaper innerShaper,
            [NotNull] LambdaExpression materializer,
            bool storeMaterializerExpression)
        {
            Check.NotNull(querySource, nameof(querySource));
            Check.NotNull(outerShaper, nameof(outerShaper));
            Check.NotNull(innerShaper, nameof(innerShaper));
            Check.NotNull(materializer, nameof(materializer));

            var compositeShaper
                = (Shaper)_createCompositeShaperMethodInfo
                  .MakeGenericMethod(
                      outerShaper.GetType(),
                      outerShaper.Type,
                      innerShaper.GetType(),
                      innerShaper.Type,
                      materializer.ReturnType)
                  .Invoke(
                      null,
                      new object[]
            {
                querySource,
                outerShaper,
                innerShaper,
                materializer.Compile(),
                storeMaterializerExpression ? materializer : null
            });

            return(compositeShaper);
        }