Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / data / design / TableAdapterManagerNameHandler.cs / 2 / TableAdapterManagerNameHandler.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All Rights Reserved.
// Information Contained Herein is Proprietary and Confidential.
//
//-----------------------------------------------------------------------------
namespace System.Data.Design {
using System;
using System.CodeDom;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Design;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.CodeDom.Compiler;
internal sealed class TableAdapterManagerNameHandler {
// Non-private class/method/property names used in TableAdapterManager
internal const string TableAdapterManagerClassName = "TableAdapterManager";
internal const string SelfRefComparerClass = "SelfReferenceComparer";
internal const string UpdateAllMethod = "UpdateAll";
internal const string SortSelfRefRowsMethod = "SortSelfReferenceRows";
internal const string MatchTAConnectionMethod = "MatchTableAdapterConnection";
internal const string UpdateAllRevertConnectionsVar = "revertConnections";
internal const string ConnectionVar = "_connection";
internal const string ConnectionProperty = "Connection";
internal const string BackupDataSetBeforeUpdateVar = "_backupDataSetBeforeUpdate";
internal const string BackupDataSetBeforeUpdateProperty = "BackupDataSetBeforeUpdate";
internal const string TableAdapterInstanceCountProperty = "TableAdapterInstanceCount";
internal const string UpdateOrderOptionProperty = "UpdateOrder";
internal const string UpdateOrderOptionVar = "_updateOrder";
internal const string UpdateOrderOptionEnum = "UpdateOrderOption";
internal const string UpdateOrderOptionEnumIUD = "InsertUpdateDelete";
internal const string UpdateOrderOptionEnumUID = "UpdateInsertDelete";
internal const string UpdateUpdatedRowsMethod = "UpdateUpdatedRows";
internal const string UpdateInsertedRowsMethod = "UpdateInsertedRows";
internal const string UpdateDeletedRowsMethod = "UpdateDeletedRows";
internal const string GetRealUpdatedRowsMethod = "GetRealUpdatedRows";
private MemberNameValidator tableAdapterManagerValidator = null;
private bool languageCaseInsensitive = false;
private CodeDomProvider codePrivider = null;
public TableAdapterManagerNameHandler(CodeDomProvider provider) {
this.codePrivider = provider;
this.languageCaseInsensitive = (this.codePrivider.LanguageOptions & LanguageOptions.CaseInsensitive) == LanguageOptions.CaseInsensitive;
}
private MemberNameValidator TableAdapterManagerValidator {
get {
if (tableAdapterManagerValidator == null) {
tableAdapterManagerValidator = new MemberNameValidator(
new string[]{
SelfRefComparerClass,
UpdateAllMethod,
SortSelfRefRowsMethod,
MatchTAConnectionMethod,
ConnectionVar,
ConnectionProperty,
BackupDataSetBeforeUpdateVar,
BackupDataSetBeforeUpdateProperty,
TableAdapterInstanceCountProperty,
UpdateOrderOptionProperty,
UpdateOrderOptionVar,
UpdateOrderOptionEnum,
UpdateUpdatedRowsMethod,
UpdateInsertedRowsMethod,
UpdateDeletedRowsMethod,
GetRealUpdatedRowsMethod
},
this.codePrivider, this.languageCaseInsensitive);
}
return this.tableAdapterManagerValidator;
}
}
///
/// Get a valid member name not conflict with known reserved name like ConnectionManager
///
///
///
internal string GetNewMemberName(string memberName) {
return this.TableAdapterManagerValidator.GetNewMemberName(memberName);
}
///
/// Get an valid TableAdapter property name
/// e.g. the class name can be CustomerTableAdapter
/// the property name can be CustomerTableAdapter as well if not conflict
///
///
///
internal string GetTableAdapterPropName(string className) {
return this.GetNewMemberName(className);
}
///
/// Helper function to get the TableAdapter variable name
///
/// Property Name, e.g. CustomerTableAdapter
/// variable name like _customerTableAdapter
internal string GetTableAdapterVarName(string propName) {
Debug.Assert(propName != null && propName.Length > 0);
Debug.Assert(propName.IndexOf('.') < 0);
propName = "_" + Char.ToLower(propName[0],CultureInfo.InvariantCulture) + propName.Remove(0, 1);
//
return this.GetNewMemberName(propName);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RijndaelManagedTransform.cs
- BooleanFunctions.cs
- HScrollBar.cs
- LinearKeyFrames.cs
- MarshalByValueComponent.cs
- ObjectHelper.cs
- XmlQuerySequence.cs
- OraclePermission.cs
- EntityKey.cs
- UpdateCompiler.cs
- FileDialogPermission.cs
- PropertyPathConverter.cs
- EllipticalNodeOperations.cs
- EmptyStringExpandableObjectConverter.cs
- AdjustableArrowCap.cs
- Helper.cs
- SQLInt64Storage.cs
- DataSourceControl.cs
- AssemblyFilter.cs
- nulltextnavigator.cs
- XmlMembersMapping.cs
- HyperLinkStyle.cs
- SettingsPropertyValueCollection.cs
- SerializerDescriptor.cs
- WebServiceData.cs
- RectAnimationClockResource.cs
- Recipient.cs
- DetailsViewCommandEventArgs.cs
- ClockController.cs
- WindowsStatic.cs
- MethodAccessException.cs
- _Connection.cs
- ResolvedKeyFrameEntry.cs
- IconBitmapDecoder.cs
- ToolStripSettings.cs
- XmlTypeAttribute.cs
- ElapsedEventArgs.cs
- GeometryHitTestParameters.cs
- WindowsListViewGroupHelper.cs
- IfAction.cs
- DBDataPermissionAttribute.cs
- ListViewInsertionMark.cs
- PTManager.cs
- TypeDescriptionProvider.cs
- IteratorDescriptor.cs
- HtmlFormWrapper.cs
- ExtensionSurface.cs
- CellParagraph.cs
- ComponentCodeDomSerializer.cs
- TextTreeExtractElementUndoUnit.cs
- ConfigurationHandlersInstallComponent.cs
- PropertyDescriptorCollection.cs
- DbMetaDataFactory.cs
- CultureMapper.cs
- ProxyWebPartManager.cs
- Bitmap.cs
- SafeViewOfFileHandle.cs
- EntityConnection.cs
- GPStream.cs
- StylusEventArgs.cs
- SmtpMail.cs
- SqlCacheDependencySection.cs
- DataGridRelationshipRow.cs
- CodeGenerator.cs
- MiniMapControl.xaml.cs
- SchemaSetCompiler.cs
- SharedRuntimeState.cs
- ControlBuilderAttribute.cs
- SubclassTypeValidator.cs
- UrlPath.cs
- ComponentCollection.cs
- TimeIntervalCollection.cs
- RoutedEvent.cs
- ClickablePoint.cs
- CalendarAutoFormat.cs
- _AutoWebProxyScriptWrapper.cs
- VisualTreeFlattener.cs
- ExternalFile.cs
- ColorConverter.cs
- UIElementCollection.cs
- BitConverter.cs
- RectangleHotSpot.cs
- Debug.cs
- InstanceHandleConflictException.cs
- TextRunCacheImp.cs
- QuaternionAnimationBase.cs
- Propagator.Evaluator.cs
- NameValueConfigurationElement.cs
- PointF.cs
- BrowserCapabilitiesFactory.cs
- CompletedAsyncResult.cs
- EnumerableValidator.cs
- CodeComment.cs
- EntityDataSourceSelectedEventArgs.cs
- TemplateContainer.cs
- Application.cs
- ExecutedRoutedEventArgs.cs
- _SSPIWrapper.cs
- Pair.cs
- SamlAuthorizationDecisionStatement.cs