Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConstructorNeedsTagAttribute.cs
- HtmlInputFile.cs
- LeaseManager.cs
- TableDesigner.cs
- KeyNotFoundException.cs
- VerificationAttribute.cs
- SerializationSectionGroup.cs
- _SSPIWrapper.cs
- AppDomainProtocolHandler.cs
- Helper.cs
- PrintDialog.cs
- HGlobalSafeHandle.cs
- EntityDataSourceStatementEditorForm.cs
- TagPrefixAttribute.cs
- CollectionChangedEventManager.cs
- XPathDocumentIterator.cs
- Screen.cs
- PagesSection.cs
- ActivationArguments.cs
- InfoCardKeyedHashAlgorithm.cs
- HeaderUtility.cs
- ExpressionBindingsDialog.cs
- NamespaceMapping.cs
- DataListItem.cs
- AuthenticationService.cs
- DataBoundControlHelper.cs
- RadioButtonStandardAdapter.cs
- ActivitySurrogateSelector.cs
- XPathChildIterator.cs
- MenuCommand.cs
- UnsafeNativeMethods.cs
- DataGridViewImageColumn.cs
- MetadataArtifactLoader.cs
- Rect3DValueSerializer.cs
- Binding.cs
- DisplayMemberTemplateSelector.cs
- Win32SafeHandles.cs
- XsltConvert.cs
- DetailsView.cs
- OdbcConnectionPoolProviderInfo.cs
- FormsAuthenticationModule.cs
- MemoryFailPoint.cs
- PropertyRef.cs
- ActivationServices.cs
- RetriableClipboard.cs
- Mapping.cs
- TextFragmentEngine.cs
- DataGridHeaderBorder.cs
- StateMachineWorkflow.cs
- DataIdProcessor.cs
- SystemInformation.cs
- ImageCodecInfoPrivate.cs
- EventLogQuery.cs
- bindurihelper.cs
- RoleGroupCollection.cs
- DragDropManager.cs
- XmlEntityReference.cs
- OlePropertyStructs.cs
- RegisteredDisposeScript.cs
- HMACMD5.cs
- DrawingVisual.cs
- OverloadGroupAttribute.cs
- BitmapImage.cs
- ModelVisual3D.cs
- CollectionConverter.cs
- EntityKey.cs
- VisualStyleTypesAndProperties.cs
- Run.cs
- TrustLevelCollection.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- ValidationHelper.cs
- PenCursorManager.cs
- ThemeableAttribute.cs
- XmlAutoDetectWriter.cs
- XmlAttribute.cs
- SiteMapNode.cs
- DataRecordInfo.cs
- FileRecordSequenceCompletedAsyncResult.cs
- Control.cs
- DictationGrammar.cs
- SimpleWebHandlerParser.cs
- RuleSetReference.cs
- DefaultAuthorizationContext.cs
- UIPermission.cs
- WindowsFormsSectionHandler.cs
- BmpBitmapEncoder.cs
- ZipIOExtraFieldZip64Element.cs
- SqlClientPermission.cs
- Container.cs
- ContentTextAutomationPeer.cs
- ProfileSettingsCollection.cs
- SqlConnectionHelper.cs
- _NativeSSPI.cs
- EmptyEnumerator.cs
- EditingMode.cs
- StubHelpers.cs
- TypeNameConverter.cs
- DataGridRowHeaderAutomationPeer.cs
- SemaphoreSecurity.cs
- XPathBinder.cs