Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntityDesign / Design / System / Data / Entity / Design / Common / EDesignUtil.cs / 1 / EDesignUtil.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// @owner [....]
// @backupOwner [....]
//-----------------------------------------------------------------------------
namespace System.Data.Entity.Design.Common {
using Microsoft.Win32;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading;
using System.Xml;
using Microsoft.SqlServer.Server;
internal static class EDesignUtil {
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//
// Helper Functions
//
internal static string GetMessagesFromEntireExceptionChain(Exception e)
{
// get the full error message list from the inner exceptions
string message = e.Message;
int count = 0;
for (Exception inner = e.InnerException; inner != null; inner = inner.InnerException)
{
count++;
string indent = string.Empty.PadLeft(count, '\t');
message += Environment.NewLine + indent;
message += inner.Message;
}
return message;
}
static internal T CheckArgumentNull(T value, string parameterName) where T : class
{
if (null == value)
{
throw ArgumentNull(parameterName);
}
return value;
}
static internal void CheckStringArgument(string value, string parameterName)
{
// Throw ArgumentNullException when string is null
CheckArgumentNull(value, parameterName);
// Throw ArgumentException when string is empty
if (value.Length == 0)
{
throw InvalidStringArgument(parameterName);
}
}
static internal LanguageOption CheckLanguageOptionArgument(LanguageOption value, string paramName)
{
if (value == LanguageOption.GenerateCSharpCode ||
value == LanguageOption.GenerateVBCode)
{
return value;
}
throw ArgumentOutOfRange(paramName);
}
static internal ArgumentException InvalidStoreEntityContainer(string entityContainerName, string parameterName)
{
ArgumentException e = new ArgumentException(Strings.InvalidNonStoreEntityContainer(entityContainerName), parameterName);
return e;
}
static internal ArgumentException InvalidStringArgument(string parameterName) {
ArgumentException e = new ArgumentException(Strings.InvalidStringArgument(parameterName));
return e;
}
static internal ArgumentException EdmReservedNamespace(string namespaceName) {
ArgumentException e = new ArgumentException(Strings.ReservedNamespace(namespaceName));
return e;
}
static internal ArgumentNullException ArgumentNull(string parameter) {
ArgumentNullException e = new ArgumentNullException(parameter);
return e;
}
static internal ArgumentException Argument(string parameter)
{
ArgumentException e = new ArgumentException(parameter);
return e;
}
static internal ArgumentException Argument(string message, Exception inner)
{
ArgumentException e = new ArgumentException(message, inner);
return e;
}
static internal InvalidOperationException InvalidOperation(string error)
{
InvalidOperationException e = new InvalidOperationException(error);
return e;
}
// SSDL Generator
static internal StrongTypingException StrongTyping(string error, Exception innerException) {
StrongTypingException e = new StrongTypingException(error, innerException);
return e;
}
static internal StrongTypingException StonglyTypedAccessToNullValue(string columnName, string tableName, Exception innerException) {
return StrongTyping(Strings.StonglyTypedAccessToNullValue(columnName, tableName), innerException);
}
static internal InvalidOperationException EntityStoreGeneratorSchemaNotLoaded() {
return InvalidOperation(Strings.EntityStoreGeneratorSchemaNotLoaded);
}
static internal InvalidOperationException EntityModelGeneratorSchemaNotLoaded() {
return InvalidOperation(Strings.EntityModelGeneratorSchemaNotLoaded);
}
static internal InvalidOperationException NonSerializableType(BuiltInTypeKind kind)
{
return InvalidOperation(Strings.Serialization_UnknownGlobalItem(kind));
}
static internal InvalidOperationException MissingGenerationPatternForType(BuiltInTypeKind kind)
{
return InvalidOperation(Strings.ModelGeneration_UnGeneratableType(kind));
}
static internal ArgumentException InvalidNamespaceNameArgument(string namespaceName)
{
return new ArgumentException(Strings.InvalidNamespaceNameArgument(namespaceName));
}
static internal ArgumentException InvalidEntityContainerNameArgument(string entityContainerName)
{
return new ArgumentException(Strings.InvalidEntityContainerNameArgument(entityContainerName));
}
static internal ArgumentException DuplicateEntityContainerName(string newModelEntityContainerName, string storeEntityContainer)
{
return new ArgumentException(Strings.DuplicateEntityContainerName(newModelEntityContainerName, storeEntityContainer));
}
static internal ProviderIncompatibleException ProviderIncompatible(string message)
{
return new ProviderIncompatibleException(message);
}
static internal ProviderIncompatibleException ProviderIncompatible(string message, Exception inner)
{
return new ProviderIncompatibleException(message, inner);
}
static internal ArgumentOutOfRangeException ArgumentOutOfRange(string paramName)
{
return new ArgumentOutOfRangeException(paramName);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// @owner [....]
// @backupOwner [....]
//-----------------------------------------------------------------------------
namespace System.Data.Entity.Design.Common {
using Microsoft.Win32;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading;
using System.Xml;
using Microsoft.SqlServer.Server;
internal static class EDesignUtil {
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//
// Helper Functions
//
internal static string GetMessagesFromEntireExceptionChain(Exception e)
{
// get the full error message list from the inner exceptions
string message = e.Message;
int count = 0;
for (Exception inner = e.InnerException; inner != null; inner = inner.InnerException)
{
count++;
string indent = string.Empty.PadLeft(count, '\t');
message += Environment.NewLine + indent;
message += inner.Message;
}
return message;
}
static internal T CheckArgumentNull(T value, string parameterName) where T : class
{
if (null == value)
{
throw ArgumentNull(parameterName);
}
return value;
}
static internal void CheckStringArgument(string value, string parameterName)
{
// Throw ArgumentNullException when string is null
CheckArgumentNull(value, parameterName);
// Throw ArgumentException when string is empty
if (value.Length == 0)
{
throw InvalidStringArgument(parameterName);
}
}
static internal LanguageOption CheckLanguageOptionArgument(LanguageOption value, string paramName)
{
if (value == LanguageOption.GenerateCSharpCode ||
value == LanguageOption.GenerateVBCode)
{
return value;
}
throw ArgumentOutOfRange(paramName);
}
static internal ArgumentException InvalidStoreEntityContainer(string entityContainerName, string parameterName)
{
ArgumentException e = new ArgumentException(Strings.InvalidNonStoreEntityContainer(entityContainerName), parameterName);
return e;
}
static internal ArgumentException InvalidStringArgument(string parameterName) {
ArgumentException e = new ArgumentException(Strings.InvalidStringArgument(parameterName));
return e;
}
static internal ArgumentException EdmReservedNamespace(string namespaceName) {
ArgumentException e = new ArgumentException(Strings.ReservedNamespace(namespaceName));
return e;
}
static internal ArgumentNullException ArgumentNull(string parameter) {
ArgumentNullException e = new ArgumentNullException(parameter);
return e;
}
static internal ArgumentException Argument(string parameter)
{
ArgumentException e = new ArgumentException(parameter);
return e;
}
static internal ArgumentException Argument(string message, Exception inner)
{
ArgumentException e = new ArgumentException(message, inner);
return e;
}
static internal InvalidOperationException InvalidOperation(string error)
{
InvalidOperationException e = new InvalidOperationException(error);
return e;
}
// SSDL Generator
static internal StrongTypingException StrongTyping(string error, Exception innerException) {
StrongTypingException e = new StrongTypingException(error, innerException);
return e;
}
static internal StrongTypingException StonglyTypedAccessToNullValue(string columnName, string tableName, Exception innerException) {
return StrongTyping(Strings.StonglyTypedAccessToNullValue(columnName, tableName), innerException);
}
static internal InvalidOperationException EntityStoreGeneratorSchemaNotLoaded() {
return InvalidOperation(Strings.EntityStoreGeneratorSchemaNotLoaded);
}
static internal InvalidOperationException EntityModelGeneratorSchemaNotLoaded() {
return InvalidOperation(Strings.EntityModelGeneratorSchemaNotLoaded);
}
static internal InvalidOperationException NonSerializableType(BuiltInTypeKind kind)
{
return InvalidOperation(Strings.Serialization_UnknownGlobalItem(kind));
}
static internal InvalidOperationException MissingGenerationPatternForType(BuiltInTypeKind kind)
{
return InvalidOperation(Strings.ModelGeneration_UnGeneratableType(kind));
}
static internal ArgumentException InvalidNamespaceNameArgument(string namespaceName)
{
return new ArgumentException(Strings.InvalidNamespaceNameArgument(namespaceName));
}
static internal ArgumentException InvalidEntityContainerNameArgument(string entityContainerName)
{
return new ArgumentException(Strings.InvalidEntityContainerNameArgument(entityContainerName));
}
static internal ArgumentException DuplicateEntityContainerName(string newModelEntityContainerName, string storeEntityContainer)
{
return new ArgumentException(Strings.DuplicateEntityContainerName(newModelEntityContainerName, storeEntityContainer));
}
static internal ProviderIncompatibleException ProviderIncompatible(string message)
{
return new ProviderIncompatibleException(message);
}
static internal ProviderIncompatibleException ProviderIncompatible(string message, Exception inner)
{
return new ProviderIncompatibleException(message, inner);
}
static internal ArgumentOutOfRangeException ArgumentOutOfRange(string paramName)
{
return new ArgumentOutOfRangeException(paramName);
}
}
}
// 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
- TextMetrics.cs
- HtmlFormWrapper.cs
- Timeline.cs
- TripleDES.cs
- TypedRowGenerator.cs
- VsPropertyGrid.cs
- GenericWebPart.cs
- PrincipalPermissionMode.cs
- TextEditorParagraphs.cs
- OciHandle.cs
- Int16.cs
- HttpCachePolicyElement.cs
- ArgIterator.cs
- ApplicationId.cs
- ReflectPropertyDescriptor.cs
- AnnotationComponentChooser.cs
- XmlUtil.cs
- Exceptions.cs
- DrawingAttributes.cs
- DragDeltaEventArgs.cs
- ObjectReferenceStack.cs
- sqlmetadatafactory.cs
- ImageFormat.cs
- MenuTracker.cs
- ToolStripItemImageRenderEventArgs.cs
- DocumentAutomationPeer.cs
- AutomationPatternInfo.cs
- MsmqInputMessagePool.cs
- ScrollContentPresenter.cs
- X509CertificateValidator.cs
- Stylus.cs
- DataGridViewDataErrorEventArgs.cs
- smtppermission.cs
- XamlSerializerUtil.cs
- WinCategoryAttribute.cs
- BamlLocalizationDictionary.cs
- StringFunctions.cs
- PageAdapter.cs
- ConnectionConsumerAttribute.cs
- BatchWriter.cs
- FontWeightConverter.cs
- StackOverflowException.cs
- GetLastErrorDetailsRequest.cs
- XmlDataDocument.cs
- CellRelation.cs
- GenerateHelper.cs
- DataGridViewHitTestInfo.cs
- CalendarAutoFormat.cs
- MembershipPasswordException.cs
- HttpRuntimeSection.cs
- StylusEventArgs.cs
- BamlRecordHelper.cs
- Root.cs
- Drawing.cs
- EnumValAlphaComparer.cs
- ReaderWriterLock.cs
- TextTreeTextBlock.cs
- ResourceAttributes.cs
- BoolExpressionVisitors.cs
- ExtendedProtectionPolicy.cs
- SessionState.cs
- XPathMultyIterator.cs
- ChangeInterceptorAttribute.cs
- BridgeDataReader.cs
- contentDescriptor.cs
- DocumentXPathNavigator.cs
- ControlCollection.cs
- FlowDocumentReaderAutomationPeer.cs
- OleDbConnectionInternal.cs
- ResolveNextArgumentWorkItem.cs
- SqlMetaData.cs
- NullableBoolConverter.cs
- TraceHandlerErrorFormatter.cs
- Size.cs
- WebPartDescriptionCollection.cs
- ProcessHostMapPath.cs
- UInt32Converter.cs
- SchemaInfo.cs
- ToolStripLocationCancelEventArgs.cs
- SiteOfOriginPart.cs
- TripleDESCryptoServiceProvider.cs
- ResourcePermissionBase.cs
- QueryMatcher.cs
- TransformCollection.cs
- CopyNodeSetAction.cs
- TextEditorTables.cs
- GridViewEditEventArgs.cs
- Object.cs
- OAVariantLib.cs
- DBConnectionString.cs
- ReadOnlyAttribute.cs
- CoreSwitches.cs
- RotateTransform.cs
- BaseParaClient.cs
- MetadataImporterQuotas.cs
- InputScopeAttribute.cs
- _NestedMultipleAsyncResult.cs
- StopStoryboard.cs
- SqlDataSourceDesigner.cs
- ImageMapEventArgs.cs