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
- ChannelBase.cs
- IpcClientChannel.cs
- SendMailErrorEventArgs.cs
- ParagraphVisual.cs
- MetadataArtifactLoaderCompositeFile.cs
- DataObjectAttribute.cs
- PeerNearMe.cs
- EmptyStringExpandableObjectConverter.cs
- UmAlQuraCalendar.cs
- CssClassPropertyAttribute.cs
- PropertyMapper.cs
- ConfigXmlElement.cs
- MatrixTransform.cs
- NameValueFileSectionHandler.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- Attributes.cs
- DependencySource.cs
- FixedPageProcessor.cs
- TemplatedWizardStep.cs
- XsltFunctions.cs
- FontCollection.cs
- NonParentingControl.cs
- XmlComment.cs
- TimerEventSubscriptionCollection.cs
- CssStyleCollection.cs
- PreservationFileReader.cs
- RelatedEnd.cs
- FontInfo.cs
- GCHandleCookieTable.cs
- SplitContainer.cs
- HashJoinQueryOperatorEnumerator.cs
- AuthenticationSection.cs
- ViewManager.cs
- Repeater.cs
- CommonObjectSecurity.cs
- ClusterRegistryConfigurationProvider.cs
- ListViewTableRow.cs
- ValueProviderWrapper.cs
- __Error.cs
- MatrixKeyFrameCollection.cs
- SmtpException.cs
- KnownColorTable.cs
- ProxyManager.cs
- DocumentPage.cs
- ExpressionConverter.cs
- BindingWorker.cs
- MemberAccessException.cs
- BrowserCapabilitiesFactory35.cs
- ObjectTypeMapping.cs
- PopupRootAutomationPeer.cs
- WorkflowOperationInvoker.cs
- WebBrowserUriTypeConverter.cs
- BamlLocalizer.cs
- HtmlControl.cs
- ScriptControl.cs
- Misc.cs
- Literal.cs
- CatalogZoneDesigner.cs
- XamlTemplateSerializer.cs
- DispatcherObject.cs
- DomNameTable.cs
- StackOverflowException.cs
- WriteableBitmap.cs
- listitem.cs
- VisualBrush.cs
- ObfuscationAttribute.cs
- X509SecurityToken.cs
- BitmapScalingModeValidation.cs
- CounterSample.cs
- ModuleElement.cs
- WindowsTitleBar.cs
- ParentUndoUnit.cs
- ComponentEditorForm.cs
- LineUtil.cs
- UshortList2.cs
- IsolatedStoragePermission.cs
- validationstate.cs
- WindowsStatusBar.cs
- ManagedIStream.cs
- ProviderMetadataCachedInformation.cs
- Cursor.cs
- PropertiesTab.cs
- WmpBitmapEncoder.cs
- RadioButtonBaseAdapter.cs
- ValidatorAttribute.cs
- Vector3DValueSerializer.cs
- XmlQueryContext.cs
- RelationshipDetailsRow.cs
- HtmlInputCheckBox.cs
- FrameworkElementFactoryMarkupObject.cs
- DataKey.cs
- IResourceProvider.cs
- Label.cs
- SmtpSection.cs
- QilTernary.cs
- UnsafeNativeMethods.cs
- FixedHighlight.cs
- HashMembershipCondition.cs
- DesignTimeTemplateParser.cs
- PersonalizationState.cs