System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.AddSpanMapping C# (CSharp) Method

AddSpanMapping() private method

Adds a new mapping from DbExpression => Span information for the specified expression, after first ensuring that the mapping dictionary has been instantiated.
private AddSpanMapping ( DbExpression expression, Span span ) : DbExpression
expression DbExpression The expression for which Span information should be added
span Span // The Span information, which may be null . If null , no attempt is made to update the dictionary of span mappings. //
return DbExpression
        private DbExpression AddSpanMapping(DbExpression expression, Span span)
        {
            if (span != null
                && CanIncludeSpanInfo())
            {
                if (null == _spanMappings)
                {
                    _spanMappings = new Dictionary<DbExpression, Span>();
                }
                Span storedSpan = null;
                if (_spanMappings.TryGetValue(expression, out storedSpan))
                {
                    foreach (var sp in span.SpanList)
                    {
                        storedSpan.AddSpanPath(sp);
                    }
                    _spanMappings[expression] = storedSpan;
                }
                else
                {
                    _spanMappings[expression] = span;
                }
            }

            return expression;
        }