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
- EmissiveMaterial.cs
- TypeContext.cs
- JsonServiceDocumentSerializer.cs
- GridView.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- WindowInteractionStateTracker.cs
- ScriptComponentDescriptor.cs
- WindowsToolbarItemAsMenuItem.cs
- TraceInternal.cs
- InvokeProviderWrapper.cs
- TreeViewImageIndexConverter.cs
- TypeSystemHelpers.cs
- ServicePoint.cs
- ImageListUtils.cs
- PreservationFileReader.cs
- ToolStripItemRenderEventArgs.cs
- PersonalizationProvider.cs
- X509CertificateValidationMode.cs
- GradientSpreadMethodValidation.cs
- SBCSCodePageEncoding.cs
- CodeArgumentReferenceExpression.cs
- UserValidatedEventArgs.cs
- CodeTypeMember.cs
- GenericsInstances.cs
- ConfigurationStrings.cs
- CqlLexerHelpers.cs
- CultureInfoConverter.cs
- TextEditorSpelling.cs
- DockPanel.cs
- PkcsUtils.cs
- InvalidEnumArgumentException.cs
- DataObjectCopyingEventArgs.cs
- URLAttribute.cs
- XmlComment.cs
- PolyLineSegment.cs
- SortedDictionary.cs
- ResourceReferenceExpression.cs
- SafeCoTaskMem.cs
- FrameDimension.cs
- SoapReflectionImporter.cs
- GridToolTip.cs
- BookmarkScopeHandle.cs
- EdmSchemaAttribute.cs
- HttpModulesSection.cs
- X509Certificate2Collection.cs
- PrincipalPermission.cs
- DataBoundControlAdapter.cs
- QueryOperationResponseOfT.cs
- QueryOutputWriter.cs
- ServiceAppDomainAssociationProvider.cs
- CompilationSection.cs
- DataSysAttribute.cs
- LineServices.cs
- Compiler.cs
- WebBrowserBase.cs
- WizardStepBase.cs
- SqlNodeAnnotation.cs
- Point3DAnimationUsingKeyFrames.cs
- RandomNumberGenerator.cs
- AudioStateChangedEventArgs.cs
- Row.cs
- TdsParserStateObject.cs
- QueryCacheManager.cs
- WebPartCatalogAddVerb.cs
- Attributes.cs
- CodeTypeParameter.cs
- BitmapMetadataEnumerator.cs
- _DigestClient.cs
- SqlUtil.cs
- CodeCommentStatement.cs
- Screen.cs
- HotSpot.cs
- DataException.cs
- WebPartDescriptionCollection.cs
- EntityContainerRelationshipSetEnd.cs
- WsatConfiguration.cs
- MapPathBasedVirtualPathProvider.cs
- UnitySerializationHolder.cs
- NamedPipeProcessProtocolHandler.cs
- QilParameter.cs
- PocoPropertyAccessorStrategy.cs
- OdbcCommandBuilder.cs
- XmlSignatureManifest.cs
- MILUtilities.cs
- RootProjectionNode.cs
- AsnEncodedData.cs
- MethodCallTranslator.cs
- __Error.cs
- CombinedGeometry.cs
- xml.cs
- HTTPNotFoundHandler.cs
- RegisteredHiddenField.cs
- HttpGetProtocolImporter.cs
- COSERVERINFO.cs
- ProcessModuleCollection.cs
- BooleanSwitch.cs
- Double.cs
- HotSpot.cs
- EnterpriseServicesHelper.cs
- WebConfigurationManager.cs