Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / SchemaElementLookUpTable.cs / 2 / SchemaElementLookUpTable.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Data; using System.Data.Metadata.Edm; namespace System.Data.EntityModel.SchemaObjectModel { ////// Summary description for SchemaElementLookUpTable. /// internal sealed class SchemaElementLookUpTable: IEnumerable , ISchemaElementLookUpTable where T : SchemaElement { #region Instance Fields private Dictionary _keyToType = null; private List _keysInDefOrder = new List (); #endregion #region Public Methods /// /// /// public SchemaElementLookUpTable() { } ////// /// public int Count { get { return KeyToType.Count; } } ////// /// /// ///public bool ContainsKey(string key) { return KeyToType.ContainsKey(KeyFromName(key)); } /// /// /// /// ///public T LookUpEquivalentKey(string key) { key = KeyFromName(key); T element; if (KeyToType.TryGetValue(key, out element)) { return element; } return null; } /// /// /// public T this[string key] { get { return KeyToType[KeyFromName(key)]; } } ////// /// public T GetElementAt(int index) { return KeyToType[_keysInDefOrder[index]]; } ////// /// ///public IEnumerator GetEnumerator() { return new SchemaElementLookUpTableEnumerator (KeyToType,_keysInDefOrder); } IEnumerator System.Collections.IEnumerable.GetEnumerator() { return new SchemaElementLookUpTableEnumerator (KeyToType,_keysInDefOrder); } /// /// /// ///public IEnumerator GetFilteredEnumerator() where S : T { return new SchemaElementLookUpTableEnumerator(KeyToType,_keysInDefOrder); } ////// Add the given type to the schema look up table. If there is an error, it /// adds the error and returns false. otherwise, it adds the type to the lookuptable /// and returns true /// public AddErrorKind TryAdd(T type) { Debug.Assert(type != null, "type parameter is null"); if (String.IsNullOrEmpty(type.Identity)) { return AddErrorKind.MissingNameError; } string key = KeyFromElement(type); T element; if (KeyToType.TryGetValue(key, out element)) { return AddErrorKind.DuplicateNameError; } KeyToType.Add(key,type); _keysInDefOrder.Add(key); return AddErrorKind.Succeeded; } public void Add(T type, bool doNotAddErrorForEmptyName, Func
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LineVisual.cs
- BitmapMetadata.cs
- WmlCalendarAdapter.cs
- CfgArc.cs
- KnownTypesHelper.cs
- XmlAnyElementAttributes.cs
- Variable.cs
- WebEventCodes.cs
- FlowDocumentScrollViewer.cs
- TextSelectionProcessor.cs
- ChangePasswordAutoFormat.cs
- Matrix.cs
- TimeSpanValidatorAttribute.cs
- TreeWalker.cs
- HtmlImage.cs
- FocusWithinProperty.cs
- X509Certificate.cs
- ContentType.cs
- FormDesigner.cs
- unsafenativemethodsother.cs
- WebBrowserContainer.cs
- WindowsSpinner.cs
- NamespaceList.cs
- StandardMenuStripVerb.cs
- GridViewRow.cs
- ConfigXmlText.cs
- Char.cs
- HtmlControlPersistable.cs
- BulletedListEventArgs.cs
- AmbiguousMatchException.cs
- CodeDelegateCreateExpression.cs
- SignatureResourcePool.cs
- PartitionResolver.cs
- DocumentSchemaValidator.cs
- ThemeDirectoryCompiler.cs
- SqlAggregateChecker.cs
- ClientConfigPaths.cs
- Emitter.cs
- ConnectionModeReader.cs
- CachedPathData.cs
- BufferedOutputStream.cs
- KeySplineConverter.cs
- ToolStripManager.cs
- DataAdapter.cs
- ZipIOExtraField.cs
- ControlDesigner.cs
- ObfuscateAssemblyAttribute.cs
- DataGridViewHitTestInfo.cs
- MonthCalendar.cs
- SQLSingleStorage.cs
- HtmlInputReset.cs
- NativeMethodsCLR.cs
- CompositeCollectionView.cs
- DesignTimeVisibleAttribute.cs
- Types.cs
- SchemaTypeEmitter.cs
- DiagnosticTraceSource.cs
- ApplicationException.cs
- WindowsTab.cs
- DbConnectionStringBuilder.cs
- XmlExtensionFunction.cs
- AdRotator.cs
- CommentEmitter.cs
- CompilerTypeWithParams.cs
- MouseButton.cs
- TextTreeDeleteContentUndoUnit.cs
- VirtualPathProvider.cs
- SID.cs
- WmfPlaceableFileHeader.cs
- HandleExceptionArgs.cs
- ParenExpr.cs
- LinkLabelLinkClickedEvent.cs
- HttpCacheVaryByContentEncodings.cs
- StaticExtensionConverter.cs
- DynamicQueryableWrapper.cs
- ToolStripSeparatorRenderEventArgs.cs
- OleDbRowUpdatedEvent.cs
- AssemblyLoader.cs
- DragDrop.cs
- ZeroOpNode.cs
- OracleNumber.cs
- TransformerConfigurationWizardBase.cs
- VersionPair.cs
- Window.cs
- SHA512.cs
- SignedXml.cs
- PersistencePipeline.cs
- IOThreadScheduler.cs
- tooltip.cs
- InputBinder.cs
- GroupLabel.cs
- DataProtection.cs
- DefaultValidator.cs
- NotFiniteNumberException.cs
- TransformValueSerializer.cs
- TabletCollection.cs
- FixedTextPointer.cs
- HostingEnvironment.cs
- TransformerInfoCollection.cs
- ClientRuntimeConfig.cs