internal ExpressionBuiltEventArgs?OnExpressionBuilt(
            InstanceProducer instanceProducer, Expression expression)
        {
            if (this.expressionBuilt != null)
            {
                var relationships =
                    new KnownRelationshipCollection(instanceProducer.GetRelationships().ToList());

                var e = new ExpressionBuiltEventArgs(
                    instanceProducer.ServiceType,
                    expression,
                    instanceProducer,
                    replacedRegistration: instanceProducer.Registration,
                    knownRelationships: relationships);

                this.expressionBuilt(this, e);

                if (relationships.HasChanged)
                {
                    instanceProducer.ReplaceRelationships(e.KnownRelationships);
                }

                return(e);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        internal void OnExpressionBuilt(ExpressionBuiltEventArgs e, InstanceProducer instanceProducer)
        {
            if (this.expressionBuilt != null)
            {
                var relationships =
                    new KnownRelationshipCollection(instanceProducer.GetRelationships().ToList());

                e.KnownRelationships = relationships;

                this.expressionBuilt(this, e);

                if (relationships.HasChanged)
                {
                    instanceProducer.ReplaceRelationships(e.KnownRelationships);
                }
            }
        }