protected internal override Expression VisitEmbeddedEntity(EmbeddedEntityExpression eee)
            {
                var embeddedParam = Expression.Parameter(eee.Type);

                var embeddedAssign = Expression.Assign(embeddedParam, Expression.New(eee.Type));

                var embeddedBindings =
                    eee.Bindings.Select(b =>
                {
                    var field = Expression.Field(embeddedParam, b.FieldInfo);

                    var value = b.Binding is ChildProjectionExpression ?
                                VisitMListChildProjection((ChildProjectionExpression)b.Binding, field) :
                                Convert(Visit(b.Binding), b.FieldInfo.FieldType);

                    return(Expression.Assign(field, value));
                }).ToList <Expression>();

                embeddedBindings.Insert(0, embeddedAssign);

                if (typeof(EmbeddedEntity).IsAssignableFrom(eee.Type))
                {
                    embeddedBindings.Add(Expression.Call(retriever, miModifiablePostRetrieving.MakeGenericMethod(eee.Type), embeddedParam));
                }
                else
                {
                    embeddedBindings.Add(embeddedParam);
                }

                var block = Expression.Block(eee.Type, new[] { embeddedParam }, embeddedBindings);

                return(Expression.Condition(Expression.Equal(Visit(eee.HasValue.Nullify()), Expression.Constant(true, typeof(bool?))),
                                            block,
                                            Expression.Constant(null, block.Type)));
            }
예제 #2
0
        protected internal virtual Expression VisitEmbeddedEntity(EmbeddedEntityExpression eee)
        {
            var bindings = Visit(eee.Bindings, VisitFieldBinding);
            var hasValue = Visit(eee.HasValue);

            if (eee.Bindings != bindings || eee.HasValue != hasValue)
            {
                return(new EmbeddedEntityExpression(eee.Type, hasValue, bindings, eee.FieldEmbedded, eee.ViewTable));
            }
            return(eee);
        }
예제 #3
0
        protected internal override Expression VisitEmbeddedEntity(EmbeddedEntityExpression eee)
        {
            var bindings = VisitBindings(eee.Bindings);
            var hasValue = Visit(eee.HasValue);

            if (eee.Bindings != bindings || eee.HasValue != hasValue || eee.EntityContext != null)
            {
                return(new EmbeddedEntityExpression(eee.Type, hasValue, bindings, eee.FieldEmbedded, eee.ViewTable, null));
            }
            return(eee);
        }
예제 #4
0
        protected internal virtual Expression VisitEmbeddedEntity(EmbeddedEntityExpression eee)
        {
            var bindings      = Visit(eee.Bindings, VisitFieldBinding);
            var hasValue      = Visit(eee.HasValue);
            var entityContext = eee.EntityContext == null ? null : VisitEntityContextInfo(eee.EntityContext);

            if (eee.Bindings != bindings || eee.HasValue != hasValue || eee.EntityContext != entityContext)
            {
                return(new EmbeddedEntityExpression(eee.Type, hasValue, bindings, eee.FieldEmbedded, eee.ViewTable, entityContext));
            }
            return(eee);
        }
예제 #5
0
 static Expression EmbeddedNullEquals(EmbeddedEntityExpression eee)
 {
     return(Expression.Not(eee.HasValue));
 }
예제 #6
0
 protected internal override Expression VisitEmbeddedEntity(EmbeddedEntityExpression eee)
 {
     throw InvalidSqlExpression(eee);
 }
예제 #7
0
 protected virtual bool CompareEmbeddedFieldInit(EmbeddedEntityExpression a, EmbeddedEntityExpression b)
 {
     return(Compare(a.HasValue, b.HasValue) &&
            a.FieldEmbedded == b.FieldEmbedded &&
            CompareList(a.Bindings, b.Bindings, CompareFieldBinding));
 }
예제 #8
0
 static Expression EmbeddedNullEquals(EmbeddedEntityExpression eee)
 {
     return Expression.Not(eee.HasValue);
 }
예제 #9
0
        protected virtual Expression VisitEmbeddedEntity(EmbeddedEntityExpression eee)
        {
            var bindings = eee.Bindings.NewIfChange(VisitFieldBinding);
            var hasValue = Visit(eee.HasValue);

            if (eee.Bindings != bindings || eee.HasValue != hasValue)
            {
                return new EmbeddedEntityExpression(eee.Type, hasValue, bindings, eee.FieldEmbedded);
            }
            return eee;
        }
예제 #10
0
 protected override Expression VisitEmbeddedEntity(EmbeddedEntityExpression eee)
 {
     throw InvalidSqlExpression(eee);
 }