Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Metadata / ObjectLayer / LoadMessageLogger.cs / 1305376 / LoadMessageLogger.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.Data.Entity; namespace System.Data.Metadata.Edm { internal class LoadMessageLogger { private Action_logLoadMessage; private Dictionary _messages = new Dictionary (); internal LoadMessageLogger(Action logLoadMessage) { this._logLoadMessage = logLoadMessage; } internal void LogLoadMessage(string message, EdmType relatedType) { if (_logLoadMessage != null) { _logLoadMessage(message); } LogMessagesWithTypeInfo(message, relatedType); } internal string CreateErrorMessageWithTypeSpecificLoadLogs(string errorMessage, EdmType relatedType) { return new StringBuilder(errorMessage) .AppendLine(this.GetTypeRelatedLogMessage(relatedType)).ToString(); } private string GetTypeRelatedLogMessage(EdmType relatedType) { Debug.Assert(relatedType != null, "have to pass in a type to get the message"); if (this._messages.ContainsKey(relatedType)) { return new StringBuilder() .AppendLine() .AppendLine(Strings.ExtraInfo) .AppendLine(this._messages[relatedType].ToString()).ToString(); } else { return string.Empty; } } private void LogMessagesWithTypeInfo(string message, EdmType relatedType) { Debug.Assert(relatedType != null, "have to have a type with this message"); if (this._messages.ContainsKey(relatedType)) { // if this type already contains loading message, append the new message to the end this._messages[relatedType].AppendLine(message); } else { this._messages.Add(relatedType, new StringBuilder(message)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.Data.Entity; namespace System.Data.Metadata.Edm { internal class LoadMessageLogger { private Action_logLoadMessage; private Dictionary _messages = new Dictionary (); internal LoadMessageLogger(Action logLoadMessage) { this._logLoadMessage = logLoadMessage; } internal void LogLoadMessage(string message, EdmType relatedType) { if (_logLoadMessage != null) { _logLoadMessage(message); } LogMessagesWithTypeInfo(message, relatedType); } internal string CreateErrorMessageWithTypeSpecificLoadLogs(string errorMessage, EdmType relatedType) { return new StringBuilder(errorMessage) .AppendLine(this.GetTypeRelatedLogMessage(relatedType)).ToString(); } private string GetTypeRelatedLogMessage(EdmType relatedType) { Debug.Assert(relatedType != null, "have to pass in a type to get the message"); if (this._messages.ContainsKey(relatedType)) { return new StringBuilder() .AppendLine() .AppendLine(Strings.ExtraInfo) .AppendLine(this._messages[relatedType].ToString()).ToString(); } else { return string.Empty; } } private void LogMessagesWithTypeInfo(string message, EdmType relatedType) { Debug.Assert(relatedType != null, "have to have a type with this message"); if (this._messages.ContainsKey(relatedType)) { // if this type already contains loading message, append the new message to the end this._messages[relatedType].AppendLine(message); } else { this._messages.Add(relatedType, new StringBuilder(message)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlCodeExporter.cs
- XmlWhitespace.cs
- StateValidator.cs
- ListViewItem.cs
- Clipboard.cs
- TextParagraphCache.cs
- TraceSwitch.cs
- CodeRegionDirective.cs
- ToolStripStatusLabel.cs
- Operand.cs
- WorkflowQueuingService.cs
- ExpressionBuilder.cs
- ContractMethodParameterInfo.cs
- IssuanceTokenProviderState.cs
- TextElementEnumerator.cs
- RichTextBoxDesigner.cs
- Clause.cs
- QueryCursorEventArgs.cs
- HttpApplicationFactory.cs
- QueryContinueDragEventArgs.cs
- ArrayList.cs
- CodeDOMProvider.cs
- HttpCapabilitiesBase.cs
- ArraySet.cs
- Enum.cs
- BindingListCollectionView.cs
- AlternateView.cs
- ToolStripButton.cs
- SqlSupersetValidator.cs
- ParameterCollection.cs
- ReadOnlyCollection.cs
- ActiveXSerializer.cs
- InvalidComObjectException.cs
- XmlRootAttribute.cs
- HostUtils.cs
- AuthenticationManager.cs
- Parameter.cs
- ISessionStateStore.cs
- NativeMethods.cs
- HtmlForm.cs
- UInt32Converter.cs
- QilInvoke.cs
- AlphabeticalEnumConverter.cs
- StateValidator.cs
- DrawToolTipEventArgs.cs
- MatrixTransform3D.cs
- RedirectionProxy.cs
- WebPartsSection.cs
- SqlCaseSimplifier.cs
- CellRelation.cs
- DesignParameter.cs
- Visual3D.cs
- RelationshipEndCollection.cs
- EventArgs.cs
- ObjectQueryExecutionPlan.cs
- Trace.cs
- Profiler.cs
- CategoryNameCollection.cs
- HttpPostClientProtocol.cs
- SelectionItemPatternIdentifiers.cs
- SevenBitStream.cs
- SqlConnectionFactory.cs
- EdmToObjectNamespaceMap.cs
- SqlVersion.cs
- StyleXamlTreeBuilder.cs
- WriteLine.cs
- WinEventTracker.cs
- SingleAnimationBase.cs
- SimpleTextLine.cs
- BitmapMetadataEnumerator.cs
- UrlMappingCollection.cs
- SimpleBitVector32.cs
- ellipse.cs
- DbUpdateCommandTree.cs
- InternalConfigConfigurationFactory.cs
- TraceSection.cs
- BoundingRectTracker.cs
- MissingManifestResourceException.cs
- TreeNode.cs
- WindowsRichEditRange.cs
- XmlCustomFormatter.cs
- ToolStripRenderer.cs
- WindowsSolidBrush.cs
- EdmToObjectNamespaceMap.cs
- SafeSystemMetrics.cs
- CodeCastExpression.cs
- ListDictionaryInternal.cs
- HelpEvent.cs
- CardSpaceSelector.cs
- XPathParser.cs
- SqlParameterizer.cs
- UpdateCompiler.cs
- DrawingGroupDrawingContext.cs
- WindowsContainer.cs
- Policy.cs
- ValueQuery.cs
- SnapshotChangeTrackingStrategy.cs
- DetailsViewPagerRow.cs
- DataGridColumnEventArgs.cs
- ObjectContext.cs