private static IScopeContextInternal CreateConcreteType <T>(IScopeContextInternal context) { context = new ScopeContext(context.BoundType.MakeConcreteType(typeof(T).GetGenericArguments())).SetScope( context.ActivationScope.GetValueOrDefault(ScopeContext.GetDefaultScope())); return(context); }
public void NestedWriteLocking3() { var d = new SnapDictionary <int, string>(); var t = d.Test; t.CollectAuto = false; Assert.AreEqual(0, d.CreateSnapshot().Gen); var scopeContext = new ScopeContext(); var scopeProvider1 = GetScopeProvider(); var scopeProvider2 = GetScopeProvider(scopeContext); using (var w1 = d.GetScopedWriteLock(scopeProvider1)) { Assert.AreEqual(1, t.LiveGen); Assert.AreEqual(1, t.WLocked); Assert.IsTrue(t.NextGen); using (var w2 = d.GetScopedWriteLock(scopeProvider2)) { Assert.AreEqual(1, t.LiveGen); Assert.AreEqual(2, t.WLocked); Assert.IsTrue(t.NextGen); Assert.AreNotSame(w1, w2); d.Set(1, "one"); } } }
public void ScopePropertyFormatTests() { // Arrange ScopeContext.Clear(); var logFactory = new LogFactory(); logFactory.Setup().LoadConfigurationFromXml(@" <nlog> <targets><target name='debug' type='Debug' layout='${scopeproperty:item=myitem:format=@} ${message}' /></targets> <rules> <logger name='*' minlevel='Debug' writeTo='debug' /> </rules> </nlog>"); var logger = logFactory.GetCurrentClassLogger(); var target = logFactory.Configuration.FindTargetByName <NLog.Targets.DebugTarget>("debug"); // Act using (logger.PushScopeProperty("myitem", new { RequestId = 123 })) { logger.Debug("a"); } // Assert Assert.Equal("{\"RequestId\":123} a", target.LastMessage); }
public void TargetWithContextConfigTest() { Target.Register("contexttarget", typeof(CustomTargetWithContext)); LogManager.Configuration = XmlLoggingConfiguration.CreateFromXmlString(@" <nlog throwExceptions='true'> <targets> <target name='debug' type='contexttarget' includeCallSite='true'> <contextproperty name='threadid' layout='${threadid}' hello='world' /> </target> </targets> <rules> <logger name='*' levels='Error' writeTo='debug' /> </rules> </nlog>"); ILogger logger = LogManager.GetLogger("A"); ScopeContext.Clear(); logger.Error("log message"); var target = LogManager.Configuration.FindTargetByName("debug") as CustomTargetWithContext; Assert.NotEqual(0, target.LastMessage.Length); var lastCombinedProperties = target.LastCombinedProperties; Assert.NotEmpty(lastCombinedProperties); Assert.Contains(new KeyValuePair <string, object>("threadid", System.Environment.CurrentManagedThreadId.ToString()), lastCombinedProperties); }
public void ScopeNestedTopTwoTest() { // Arrange ScopeContext.Clear(); var logFactory = new LogFactory(); logFactory.Setup().LoadConfigurationFromXml(@" <nlog> <targets><target name='debug' type='Debug' layout='${scopenested:topframes=2} ${message}' /></targets> <rules> <logger name='*' minlevel='Debug' writeTo='debug' /> </rules> </nlog>"); var logger = logFactory.GetCurrentClassLogger(); var target = logFactory.Configuration.FindTargetByName <NLog.Targets.DebugTarget>("debug"); // Act using (logger.PushScopeState("ala")) { using (logger.PushScopeState("ma")) { using (logger.PushScopeState("kota")) { logger.Debug("c"); } } } // Assert Assert.Equal("ma kota c", target.LastMessage); }
private static IScopeContextInternal CreateConcreteType(IScopeContextInternal context, Type serviceType) { context = new ScopeContext(context.BoundType.MakeConcreteType(serviceType.GetGenericArguments()), null).SetScope( context.ActivationScope.GetValueOrDefault(ScopeContext.GetDefaultScope())); return(context); }
public void ScopeNestedTwoPropertiesNewlineTest() { // Arrange ScopeContext.Clear(); var logFactory = new LogFactory(); logFactory.Setup().LoadConfigurationFromXml(@" <nlog> <targets><target name='debug' type='Debug' layout='${scopenested:format=@:separator=${newline}}' /></targets> <rules> <logger name='*' minlevel='Debug' writeTo='debug' /> </rules> </nlog>"); var logger = logFactory.GetCurrentClassLogger(); var target = logFactory.Configuration.FindTargetByName <NLog.Targets.DebugTarget>("debug"); // Act using (logger.PushScopeState(new Dictionary <string, object>() { { "Hello", 42 }, { "Unlucky", 13 } })) { logger.Debug("c"); } // Assert Assert.Equal(string.Format("[{0}{{{0}\"Hello\": 42,{0}\"Unlucky\": 13{0}}}{0}]", System.Environment.NewLine), target.LastMessage); }
public void ScopeNestedSinglePropertyTest() { // Arrange ScopeContext.Clear(); var logFactory = new LogFactory(); logFactory.Setup().LoadConfigurationFromXml(@" <nlog> <targets><target name='debug' type='Debug' layout='${scopenested:format=@}' /></targets> <rules> <logger name='*' minlevel='Debug' writeTo='debug' /> </rules> </nlog>"); var logger = logFactory.GetCurrentClassLogger(); var target = logFactory.Configuration.FindTargetByName <NLog.Targets.DebugTarget>("debug"); // Act using (logger.PushScopeState(new[] { new KeyValuePair <string, object>("Hello", "World") })) { logger.Debug("c"); } // Assert Assert.Equal("[ { \"Hello\": \"World\" } ]", target.LastMessage); }
private void LogException(ActionDescriptor actionDescriptor, HttpContext httpContext, InternalException exception) { if (!ShouldExecute(actionDescriptor)) { return; } if (exception.ExceptionHandled) { return; } var resultLogger = InitiateLogger(httpContext.RequestServices); var scopeContext = new ScopeContext(); scopeContext.Push(AppendBaseInfoToScope(actionDescriptor, httpContext, null)); scopeContext.Push(InternalHelper.CreateExceptionScopeContext(actionDescriptor, httpContext, exception)); exception.ExceptionHandled = true; using (resultLogger.BeginScope(scopeContext.ToDictionary())) { resultLogger.LogError(exception, exception.Message); } }
public void AnalizeStatement(Node node, ScopeContext scopeContext) { // Check statement Node conditionNode = node.SubNodes[0]; SkryptObject result = engine.executor.ExecuteExpression(conditionNode, scopeContext); // Check block Node blockNode = node.SubNodes[1]; Analize(blockNode, scopeContext); // Check else/elseif if (node.SubNodes.Count > 2) { for (int i = 2; i < node.SubNodes.Count; i++) { // elseif block Node elseNode = node.SubNodes[i]; if (elseNode.Body == "elseif") { AnalizeStatement(elseNode, scopeContext); } else { Analize(elseNode, scopeContext); } } } }
public void PushNestedStatePropertiesTest() { // Arrange ScopeContext.Clear(); var expectedString = "World"; var expectedGuid = System.Guid.NewGuid(); var expectedProperties = new[] { new KeyValuePair <string, object>("Hello", expectedString), new KeyValuePair <string, object>("RequestId", expectedGuid) }; var expectedNestedState = "First Push"; Dictionary <string, object> allProperties = null; object[] allNestedStates = null; object stringValueLookup = null; // Act using (ScopeContext.PushProperty("Hello", "People")) { using (ScopeContext.PushNestedStateProperties(expectedNestedState, expectedProperties)) { allNestedStates = ScopeContext.GetAllNestedStates(); allProperties = ScopeContext.GetAllProperties().ToDictionary(x => x.Key, x => x.Value); } ScopeContext.TryGetProperty("Hello", out stringValueLookup); } // Assert Assert.Equal(2, allProperties.Count); Assert.Equal(expectedString, allProperties["Hello"]); Assert.Equal(expectedGuid, allProperties["RequestId"]); Assert.Single(allNestedStates); Assert.Equal(expectedNestedState, allNestedStates[0]); Assert.Equal("People", stringValueLookup); }
public void NestedWriteLocking3() { var d = new SnapDictionary <int, string>(); var t = d.Test; t.CollectAuto = false; Assert.AreEqual(0, d.CreateSnapshot().Gen); var scopeContext = new ScopeContext(); var scopeProvider1 = GetScopeProvider(); var scopeProvider2 = GetScopeProvider(scopeContext); using (var w1 = d.GetScopedWriteLock(scopeProvider1)) { Assert.AreEqual(1, t.LiveGen); Assert.IsTrue(t.IsLocked); Assert.IsTrue(t.NextGen); Assert.Throws <InvalidOperationException>(() => { using (var w2 = d.GetScopedWriteLock(scopeProvider2)) { } }); } }
public void ReplaceNewLineWithDefaultTestMixed() { ScopeContext.PushProperty("foo", "bar\r\n123\nabc"); SimpleLayout l = "${replace-newlines:${scopeproperty:foo}}"; Assert.Equal("bar 123 abc", l.Render(LogEventInfo.CreateNullEvent())); }
/// <summary> /// Start the message broker. /// </summary> public void Start() { RegisterMessageBroker(); //Each Application has its own Scope hierarchy and the root scope is WebScope. //There's a global scope that aims to provide common resource sharing across Applications namely GlobalScope. //The GlobalScope is the parent of all WebScopes. //Other scopes in between are all instances of Scope. Each scope takes a name. //The GlobalScope is named "default". //The WebScope is named per Application context name. //The Scope is named per path name. _globalScope = new GlobalScope(); _globalScope.Name = "default"; ScopeResolver scopeResolver = new ScopeResolver(_globalScope); GodLesZ.Library.Amf.Messaging.Api.IClientRegistry clientRegistry = _clientManager; ServiceInvoker serviceInvoker = new ServiceInvoker(); ScopeContext context = new ScopeContext("/", clientRegistry, scopeResolver, serviceInvoker, null); CoreHandler handler = new CoreHandler(); _globalScope.Context = context; _globalScope.Handler = handler; _globalScope.Register(); StartServices(); StartEndpoints(); }
public void ScopeContextEnlist(bool complete) { var scopeProvider = ScopeProvider; bool? completed = null; IScope ambientScope = null; ScopeContext ambientContext = null; Assert.IsNull(scopeProvider.AmbientScope); using (var scope = scopeProvider.CreateScope()) { scopeProvider.Context.Enlist("name", c => { completed = c; ambientScope = scopeProvider.AmbientScope; ambientContext = scopeProvider.AmbientContext; }); if (complete) { scope.Complete(); } } Assert.IsNull(scopeProvider.AmbientScope); Assert.IsNull(scopeProvider.AmbientContext); Assert.IsNotNull(completed); Assert.AreEqual(complete, completed.Value); Assert.IsNull(ambientScope); // the scope is gone Assert.IsNotNull(ambientContext); // the context is still there }
public void LegacyMdlcSetShouldNotAffectStackValues3() { // Arrange ScopeContext.Clear(); var expectedValue = "Bob"; var expectedNestedState = "First Push"; object propertyValue1; object propertyValue2; object[] allNestedStates = null; var success1 = false; var success2 = false; // Act using (ScopeContext.PushNestedState(expectedNestedState)) { using (ScopeContext.PushProperty("Hello", "World")) { MappedDiagnosticsLogicalContext.Set("Hello", expectedValue); // Enter legacy mode (need to overwrite) success1 = ScopeContext.TryGetProperty("Hello", out propertyValue1); allNestedStates = ScopeContext.GetAllNestedStates(); } success2 = ScopeContext.TryGetProperty("Hello", out propertyValue2); } // Assert Assert.Single(allNestedStates); Assert.Equal(expectedNestedState, allNestedStates[0]); Assert.True(success1); Assert.Equal(expectedValue, propertyValue1); Assert.False(success2); Assert.Null(propertyValue2); }
public override void OnElement(Element element) { //Getting namespace and prefix string prefix, ns; NamespaceResolver.GetPrefixAndNs(element, _currentDocument, () => ScopeContext.Peek(), out prefix, out ns); if (string.IsNullOrEmpty(element.NsPrefix)) { prefix = null; } //Starting Element if (!string.IsNullOrEmpty(element.Name)) { if (element.Delimiter != DelimiterEnum.CCC) { //not text node _xmlTextWriter.WriteStartElement(prefix, element.Name, ns); AddLocationMapRecord(_currentModuleMember.Module.FileName, (IMappedPair)element); //Write all namespace declarations in the root element if (!_rootElementAdded) { WritePendingNamespaceDeclarations(ns); _rootElementAdded = true; } } } else { if (element.Parent.Delimiter == DelimiterEnum.CCC && (element.Delimiter == DelimiterEnum.C || element.Delimiter == DelimiterEnum.CC)) { // This is item of explicit array (:::) WriteExplicitArrayItem(element); } } if (!ResolveValue(element) && !EnterChoiceContainer(element, element.Entities)) { base.OnElement(element); } //End Element if (!string.IsNullOrEmpty(element.Name)) { if (element.Delimiter != DelimiterEnum.CCC) //not text node and not explicit array { _xmlTextWriter.WriteEndElement(); } } else { if (element.Parent.Delimiter == DelimiterEnum.CCC && (element.Delimiter == DelimiterEnum.C || element.Delimiter == DelimiterEnum.CC)) { _xmlTextWriter.WriteEndElement(); } } }
public void NestedWriteLocking2() { var d = new SnapDictionary <int, string>(); d.Test.CollectAuto = false; Assert.AreEqual(0, d.CreateSnapshot().Gen); // scope context: writers enlist var scopeContext = new ScopeContext(); var scopeProvider = GetScopeProvider(scopeContext); using (var w1 = d.GetScopedWriteLock(scopeProvider)) { // This one is interesting, although we don't allow recursive locks, since this is // using the same ScopeContext/key, the lock acquisition is only done once using (var w2 = d.GetScopedWriteLock(scopeProvider)) { Assert.AreSame(w1, w2); d.SetLocked(1, "one"); } } }
public override void OnElement(Element node) { //Getting namespace and prefix string prefix, ns; _context.NamespaceResolver.GetPrefixAndNs(node, _currentDocument, () => { var aliasContext = AliasContext.Peek(); return(aliasContext?.AliasDefinition); }, () => ScopeContext.Peek(), out prefix, out ns); //Starting Element if (!string.IsNullOrEmpty(node.Name)) //not text node { _xmlTextWriter.WriteStartElement(prefix, node.Name, ns); } LocationMap.Add(new LexicalInfo(_currentDocument.Module.FileName, node.start.Line, node.start.Column, node.start.Index)); //Write all namespace declarations in the root element if (!_rootElementAdded) { WritePendingNamespaceDeclarations(ns); _rootElementAdded = true; } if (!ResolveValue(node)) { base.OnElement(node); } //End Element if (!string.IsNullOrEmpty(node.Name)) //not text node { _xmlTextWriter.WriteEndElement(); } }
public void LoggerPushScopePropertiesCovarianceTest(bool convertDictionary) { // Arrange ScopeContext.Clear(); var expectedString = "World"; var expectedId = 42; IReadOnlyCollection <KeyValuePair <string, IConvertible> > expectedProperties = new[] { new KeyValuePair <string, IConvertible>("Hello", expectedString), new KeyValuePair <string, IConvertible>("RequestId", expectedId) }; if (convertDictionary) { expectedProperties = expectedProperties.ToDictionary(i => i.Key, i => i.Value); } Dictionary <string, object> allProperties = null; object stringValueLookup = null; var logger = new LogFactory().GetCurrentClassLogger(); // Act using (logger.PushScopeProperty("Hello", "People")) { using (logger.PushScopeProperties(expectedProperties)) { allProperties = ScopeContext.GetAllProperties().ToDictionary(x => x.Key, x => x.Value); } ScopeContext.TryGetProperty("Hello", out stringValueLookup); } // Assert Assert.Equal(2, allProperties.Count); Assert.Equal(expectedString, allProperties["Hello"]); Assert.Equal(expectedId, allProperties["RequestId"]); Assert.Equal(expectedProperties.Select(p => new KeyValuePair <string, object>(p.Key, p.Value)), allProperties); Assert.Equal("People", stringValueLookup); }
public void DoublePushNestedStateTest() { // Arrange ScopeContext.Clear(); var expectedNestedState1 = "First Push"; var expectedNestedState2 = System.Guid.NewGuid(); object topNestedState1 = null; object topNestedState2 = null; object[] allNestedStates = null; // Act using (ScopeContext.PushNestedState(expectedNestedState1)) { topNestedState1 = ScopeContext.PeekNestedState(); using (ScopeContext.PushNestedState(expectedNestedState2)) { topNestedState2 = ScopeContext.PeekNestedState(); allNestedStates = ScopeContext.GetAllNestedStates(); } } var failed = ScopeContext.PeekNestedState() != null; // Assert Assert.Equal(expectedNestedState1, topNestedState1); Assert.Equal(expectedNestedState2, topNestedState2); Assert.Equal(2, allNestedStates.Length); Assert.Equal(expectedNestedState2, allNestedStates[0]); Assert.Equal(expectedNestedState1, allNestedStates[1]); Assert.False(failed); }
public void LoggerPushScopePropertiesTest() { // Arrange ScopeContext.Clear(); var expectedString = "World"; var expectedGuid = System.Guid.NewGuid(); var expectedProperties = new[] { new KeyValuePair <string, object>("Hello", expectedString), new KeyValuePair <string, object>("RequestId", expectedGuid) }; IEnumerable <KeyValuePair <string, object> > allPropertiesState = null; Dictionary <string, object> allProperties = null; var logger = new LogFactory().GetCurrentClassLogger(); object stringValueLookup = null; // Act using (logger.PushScopeProperties(expectedProperties)) { allPropertiesState = ScopeContext.GetAllProperties(); allProperties = allPropertiesState.ToDictionary(x => x.Key, x => x.Value); } ScopeContext.TryGetProperty("Hello", out stringValueLookup); // Assert #if !NET35 && !NET40 && !NET45 Assert.Same(expectedProperties, allPropertiesState); #endif Assert.Equal(2, allProperties.Count); Assert.Equal(expectedString, allProperties["Hello"]); Assert.Equal(expectedGuid, allProperties["RequestId"]); Assert.Equal(expectedProperties.Select(p => new KeyValuePair <string, object>(p.Key, p.Value)), allProperties); Assert.Null(stringValueLookup); }
public void LoggerPushScopePropertiesOverwriteTest() { // Arrange ScopeContext.Clear(); var expectedString = "World"; var expectedGuid = System.Guid.NewGuid(); var expectedProperties = new[] { new KeyValuePair <string, object>("Hello", expectedString), new KeyValuePair <string, object>("RequestId", expectedGuid) }; Dictionary <string, object> allProperties = null; object stringValueLookup = null; var logger = new LogFactory().GetCurrentClassLogger(); // Act using (logger.PushScopeProperty("Hello", "People")) { using (logger.PushScopeProperties(expectedProperties)) { allProperties = ScopeContext.GetAllProperties().ToDictionary(x => x.Key, x => x.Value); } ScopeContext.TryGetProperty("Hello", out stringValueLookup); } // Assert Assert.Equal(2, allProperties.Count); Assert.Equal(expectedString, allProperties["Hello"]); Assert.Equal(expectedGuid, allProperties["RequestId"]); Assert.Equal(expectedProperties.Select(p => new KeyValuePair <string, object>(p.Key, p.Value)), allProperties); Assert.Equal("People", stringValueLookup); }
public override void End(ScopeContext context, bool result) { //base.End(context, result); //if (result && _notificationAction != null) //{ // var group = context.Get<ScopeRecorder>() // ?.Records // .OfType<PropertyChangeRecord>() // .Where(r => r.Target is IPropertyChangedNotifier) // .Distinct(_comparer) // .Select(r => new { Record = r, Property = r.PropertyName }) // .GroupBy(r => r.Record.Target); // foreach (var g in group) // _notificationAction(g.Key, g.Select(r => r.Property).ToArray()); //} base.End(context, result); if (result && _notificationAction != null) { var group = context.Get<ScopeRecorder>() ?.Records .OfType<IPropertyChangeRecord>() .Where(r => r.Target is IPropertyChangedNotifier) .Distinct(_comparer) .Select(r => new { Record = r, Property = r.PropertyName }) .GroupBy(r => r.Record.Target); foreach (var g in group) _notificationAction(g.Key, g.Select(r => r.Property).ToArray()); } }
/// <summary> /// Renders the timing details of the Nested Logical Context item and appends it to the specified <see cref="StringBuilder" />. /// </summary> /// <param name="builder">The <see cref="StringBuilder"/> to append the rendered data to.</param> /// <param name="logEvent">Logging event.</param> protected override void Append(StringBuilder builder, LogEventInfo logEvent) { TimeSpan?scopeDuration = CurrentScope ? ScopeContext.PeekInnerNestedDuration() : ScopeContext.PeekOuterNestedDuration(); if (scopeDuration.HasValue) { if (scopeDuration.Value < TimeSpan.Zero) { scopeDuration = TimeSpan.Zero; } if (StartTime) { var formatProvider = GetFormatProvider(logEvent, null); var scopeBegin = Time.TimeSource.Current.Time.Subtract(scopeDuration.Value); builder.Append(scopeBegin.ToString(Format, formatProvider)); } else { #if !NET35 var formatProvider = GetFormatProvider(logEvent, null); builder.Append(scopeDuration.Value.ToString(Format, formatProvider)); #else builder.Append(scopeDuration.Value.ToString()); #endif } } }
public static IDisposable CaptureScopeProperties(IEnumerable scopePropertyCollection, ExtractorDictionary stateExtractor) { List <KeyValuePair <string, object> > propertyList = null; var keyValueExtractor = default(KeyValuePair <Func <object, object>, Func <object, object> >); foreach (var property in scopePropertyCollection) { if (property == null) { break; } if (keyValueExtractor.Key == null && !TryLookupExtractor(stateExtractor, property.GetType(), out keyValueExtractor)) { break; } var propertyValue = TryParseKeyValueProperty(keyValueExtractor, property); if (!propertyValue.HasValue) { continue; } propertyList = propertyList ?? new List <KeyValuePair <string, object> >(); propertyList.Add(propertyValue.Value); } return(ScopeContext.PushNestedStateProperties(scopePropertyCollection, propertyList)); }
public void ReplaceNewLineOneLineTest() { ScopeContext.PushProperty("foo", "bar123"); SimpleLayout l = "${replace-newlines:${scopeproperty:foo}}"; Assert.Equal("bar123", l.Render(LogEventInfo.CreateNullEvent())); }
public void LoggerPushPropertyTest() { // Arrange ScopeContext.Clear(); var expectedValue = "World"; Dictionary <string, object> allProperties = null; var success = false; object value; var logger = new LogFactory().GetCurrentClassLogger(); // Act using (logger.PushScopeProperty("HELLO", expectedValue)) { success = ScopeContext.TryGetProperty("hello", out value); allProperties = ScopeContext.GetAllProperties().ToDictionary(x => x.Key, x => x.Value); } var failed = ScopeContext.TryGetProperty("hello", out var _); // Assert Assert.True(success); Assert.Equal(expectedValue, value); Assert.Single(allProperties); Assert.Equal(expectedValue, allProperties["HELLO"]); Assert.False(failed); }
public void ReplaceNewLineWithNoEmptySeparationStringTest() { ScopeContext.PushProperty("foo", "bar" + System.Environment.NewLine + "123"); SimpleLayout l = "${replace-newlines:replacement=:${scopeproperty:foo}}"; Assert.Equal("bar123", l.Render(LogEventInfo.CreateNullEvent())); }
public void LegacyMdlcSetShouldNotAffectStackValues2() { // Arrange ScopeContext.Clear(); var expectedValue = "World"; var expectedNestedState = "First Push"; object propertyValue; object[] allNestedStates = null; var success = false; // Act using (ScopeContext.PushNestedState(expectedNestedState)) { using (ScopeContext.PushProperty("Hello", expectedValue)) { MappedDiagnosticsLogicalContext.Set("Hello", expectedValue); // Skip legacy mode (ignore when same value) success = ScopeContext.TryGetProperty("Hello", out propertyValue); allNestedStates = ScopeContext.GetAllNestedStates(); } } // Assert Assert.Single(allNestedStates); Assert.Equal(expectedNestedState, allNestedStates[0]); Assert.True(success); Assert.Equal(expectedValue, propertyValue); }
public IList<string> CompareModels(IEdmModel expected, IEdmModel actual) { this.errorMessages = new List<string>(); this.scopeContext = new ScopeContext(); // ?? caused by bad product design: xxx.VocabularyAnnotations(IEdmModel) this.expectedModel = expected; this.actualModel = actual; // TODO: compare other regular stuffs: // 0: complex type, property // 1: association, association set, function, function import, enum this.CompareEntityContainers(expected.SchemaElements.OfType<IEdmEntityContainer>(), actual.SchemaElements.OfType<IEdmEntityContainer>()); this.CompareEntityTypes(expected.SchemaElements.OfType<IEdmEntityType>(), actual.SchemaElements.OfType<IEdmEntityType>()); this.CompareValueTerms(expected.SchemaElements.OfType<IEdmValueTerm>(), actual.SchemaElements.OfType<IEdmValueTerm>()); this.CheckIsEquivalentTo(expected, actual); return this.errorMessages; }
/// <summary> /// Sets the current scope and returns an object which can be disposed to restore the /// previous scope. /// </summary> /// <param name="letScope"> The new let scope. </param> /// <param name="varScope"> The new var scope. </param> /// <returns> An object which can be disposed to restore the previous scope. </returns> private ScopeContext CreateScopeContext(Scope letScope, Scope varScope = null) { if (letScope == null) throw new ArgumentNullException("letScope"); var result = new ScopeContext(this); this.currentLetScope = letScope; if (varScope != null) this.currentVarScope = varScope; return result; }