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
- BooleanSwitch.cs
- WindowsListViewItemStartMenu.cs
- RangeValidator.cs
- GridViewRowPresenterBase.cs
- FontConverter.cs
- WebPartChrome.cs
- AggregateNode.cs
- TreeNodeBinding.cs
- EventBuilder.cs
- InlineUIContainer.cs
- FilterException.cs
- activationcontext.cs
- ControlDesigner.cs
- Thickness.cs
- DefaultValueConverter.cs
- _OSSOCK.cs
- ToolStripScrollButton.cs
- WebPartCancelEventArgs.cs
- MenuAutoFormat.cs
- RadioButtonList.cs
- SectionXmlInfo.cs
- ObjectStateFormatter.cs
- StringUtil.cs
- QilInvoke.cs
- WizardSideBarListControlItem.cs
- RenderingEventArgs.cs
- ExpressionBindings.cs
- ConfigXmlDocument.cs
- ControlFilterExpression.cs
- QuadraticEase.cs
- QilIterator.cs
- PointLight.cs
- DatePickerTextBox.cs
- ColorConvertedBitmap.cs
- CustomWebEventKey.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- PreviewPrintController.cs
- XmlBinaryReader.cs
- SerializationInfo.cs
- ProfessionalColors.cs
- EdgeProfileValidation.cs
- CryptoProvider.cs
- DSASignatureFormatter.cs
- HighlightComponent.cs
- NotifyInputEventArgs.cs
- XPathDescendantIterator.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- DataGridTable.cs
- TemplateParser.cs
- PrefixHandle.cs
- GroupByQueryOperator.cs
- UserThread.cs
- CqlQuery.cs
- HttpException.cs
- TableRowCollection.cs
- TdsParserSafeHandles.cs
- DomainUpDown.cs
- DecimalAverageAggregationOperator.cs
- ListenerAdaptersInstallComponent.cs
- PrintPreviewGraphics.cs
- PrintPageEvent.cs
- SoapExtension.cs
- ScriptControl.cs
- ActivityInfo.cs
- ADMembershipProvider.cs
- EntityDesignerDataSourceView.cs
- webeventbuffer.cs
- VisualStyleRenderer.cs
- DataPagerFieldItem.cs
- ScaleTransform3D.cs
- MsmqTransportSecurityElement.cs
- Page.cs
- WebConfigurationHostFileChange.cs
- IIS7UserPrincipal.cs
- ISessionStateStore.cs
- ArraySegment.cs
- ItemDragEvent.cs
- NameScope.cs
- CoTaskMemSafeHandle.cs
- DynamicPhysicalDiscoSearcher.cs
- EmbeddedMailObjectsCollection.cs
- InstanceDataCollectionCollection.cs
- SiteMapSection.cs
- MetadataPropertyAttribute.cs
- Parameter.cs
- TableLayoutCellPaintEventArgs.cs
- NamedPermissionSet.cs
- CodeCompiler.cs
- XmlTextWriter.cs
- SqlUtils.cs
- MouseOverProperty.cs
- Accessible.cs
- EncoderExceptionFallback.cs
- FontSizeConverter.cs
- Axis.cs
- PipeStream.cs
- EventSetter.cs
- PtsHelper.cs
- RelationshipWrapper.cs
- TextPointer.cs