Example #1
0
        protected internal virtual MixinEntityExpression VisitMixinEntity(MixinEntityExpression me)
        {
            var bindings = Visit(me.Bindings, VisitFieldBinding);

            if (me.Bindings != bindings)
            {
                return(new MixinEntityExpression(me.Type, bindings, me.MainEntityAlias, me.FieldMixin));
            }
            return(me);
        }
Example #2
0
        protected internal override MixinEntityExpression VisitMixinEntity(MixinEntityExpression me)
        {
            var bindings = VisitBindings(me.Bindings);

            if (me.Bindings != bindings || me.EntityContext != null)
            {
                return(new MixinEntityExpression(me.Type, bindings, me.MainEntityAlias, me.FieldMixin, null));
            }
            return(me);
        }
Example #3
0
        protected internal virtual MixinEntityExpression VisitMixinEntity(MixinEntityExpression me)
        {
            var bindings      = Visit(me.Bindings, VisitFieldBinding);
            var entityContext = me.EntityContext == null ? null : VisitEntityContextInfo(me.EntityContext);

            if (me.Bindings != bindings || me.EntityContext != entityContext)
            {
                return(new MixinEntityExpression(me.Type, bindings, me.MainEntityAlias, me.FieldMixin, entityContext));
            }
            return(me);
        }
Example #4
0
            BlockExpression AssignMixin(ParameterExpression e, MixinEntityExpression m)
            {
                var mixParam = Expression.Parameter(m.Type);

                var mixBindings = new List <Expression>();

                mixBindings.Add(Expression.Assign(mixParam, Expression.Call(e, MixinDeclarations.miMixin.MakeGenericMethod(m.Type))));
                mixBindings.Add(Expression.Call(retriever, miModifiablePostRetrieving.MakeGenericMethod(m.Type), mixParam));
                mixBindings.AddRange(m.Bindings.Select(b =>
                {
                    var field = Expression.Field(mixParam, b.FieldInfo);

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

                    return((Expression)Expression.Assign(field, value));
                }));

                return(Expression.Block(new[] { mixParam }, mixBindings));
            }
Example #5
0
 protected virtual bool CompareMixinFieldInit(MixinEntityExpression a, MixinEntityExpression b)
 {
     return(a.FieldMixin == b.FieldMixin &&
            CompareList(a.Bindings, b.Bindings, CompareFieldBinding));
 }
 protected internal override MixinEntityExpression VisitMixinEntity(MixinEntityExpression me)
 {
     throw new InvalidOperationException("Impossible to retrieve MixinEntity {0} without their main entity".FormatWith(me.Type.Name));
 }
Example #7
0
        protected virtual MixinEntityExpression VisitMixinEntity(MixinEntityExpression me)
        {
            var bindings = me.Bindings.NewIfChange(VisitFieldBinding);

            if (me.Bindings != bindings)
            {
                return new MixinEntityExpression(me.Type, bindings, me.FieldMixin);
            }
            return me;
        }