コード例 #1
0
        public virtual LambdaExpression CreateShaperLambda()
        {
            var valueBufferFactory = ValueBufferFactoryFactory.Create(_entityType);

            var materializationContextParameter
                = Expression.Parameter(typeof(MaterializationContext), "materializationContext");
            var materializer = Expression.Lambda(_entityMaterializerSource
                                                 .CreateMaterializeExpression(
                                                     _entityType, materializationContextParameter), materializationContextParameter);

            var jObjectParameter = Expression.Parameter(typeof(JObject), "jObject");

            return(Expression.Lambda(
                       Expression.Call(
                           typeof(EntityShaper).GetTypeInfo().GetDeclaredMethod(nameof(_Shape))
                           .MakeGenericMethod(_entityType.ClrType),
                           jObjectParameter,
                           EntityQueryModelVisitor.QueryContextParameter,
                           Expression.Constant(_entityType),
                           valueBufferFactory,
                           materializer),
                       jObjectParameter));
        }
コード例 #2
0
        public virtual LambdaExpression CreateShaperLambda()
        {
            var valueBufferFactory = ValueBufferFactoryFactory.Create(_entityType);

            var materializationContextParameter
                = Expression.Parameter(typeof(MaterializationContext), "materializationContext");
            var materializer = Expression.Lambda(_entityMaterializerSource
                                                 .CreateMaterializeExpression(
                                                     _entityType, materializationContextParameter), materializationContextParameter);

            var jObjectParameter = Expression.Parameter(typeof(JObject), "jObject");
            var shapeMethodInfo  = _useQueryBuffer ? _bufferedShapeMethodInfo : _shapeMethodInfo;

            return(Expression.Lambda(
                       Expression.Call(
                           shapeMethodInfo.MakeGenericMethod(_entityType.ClrType),
                           jObjectParameter,
                           EntityQueryModelVisitor.QueryContextParameter,
                           Expression.Constant(_entityType.FindPrimaryKey()),
                           Expression.Constant(_trackingQuery),
                           valueBufferFactory,
                           materializer),
                       jObjectParameter));
        }