Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / SchemaElementLookUpTable.cs / 1 / 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
- IteratorDescriptor.cs
- EmptyStringExpandableObjectConverter.cs
- NetworkInformationException.cs
- JsonFormatReaderGenerator.cs
- ColorTransformHelper.cs
- SecurityTokenRequirement.cs
- ListControl.cs
- oledbmetadatacollectionnames.cs
- SemanticAnalyzer.cs
- TTSEvent.cs
- DataTableTypeConverter.cs
- DirectoryInfo.cs
- CollectionType.cs
- SafeArrayTypeMismatchException.cs
- XmlWrappingWriter.cs
- IdleTimeoutMonitor.cs
- CodeSubDirectoriesCollection.cs
- DataListItemCollection.cs
- SqlDataSourceCommandEventArgs.cs
- GenericIdentity.cs
- SizeChangedEventArgs.cs
- MetadataImporterQuotas.cs
- basevalidator.cs
- Sql8ConformanceChecker.cs
- AlternateViewCollection.cs
- TripleDESCryptoServiceProvider.cs
- RtfToXamlLexer.cs
- XmlBaseWriter.cs
- ListControlBuilder.cs
- SystemNetHelpers.cs
- ImageCodecInfo.cs
- ReferenceConverter.cs
- SettingsContext.cs
- ListBase.cs
- NullReferenceException.cs
- GroupDescription.cs
- LinkConverter.cs
- DesignColumn.cs
- UIElement3D.cs
- DatatypeImplementation.cs
- UrlMappingsSection.cs
- JsonWriter.cs
- WCFServiceClientProxyGenerator.cs
- WebEncodingValidator.cs
- WeakReference.cs
- RepeatBehaviorConverter.cs
- ListViewDataItem.cs
- Block.cs
- ChangeNode.cs
- ApplicationInterop.cs
- CqlWriter.cs
- EventRecordWrittenEventArgs.cs
- Synchronization.cs
- recordstate.cs
- SessionPageStateSection.cs
- XPathNodePointer.cs
- OdbcConnectionFactory.cs
- RealizationContext.cs
- DiagnosticTrace.cs
- InheritedPropertyDescriptor.cs
- CompiledIdentityConstraint.cs
- QuotedPrintableStream.cs
- WebDisplayNameAttribute.cs
- DataGridViewCellEventArgs.cs
- SelectionRange.cs
- WebPartDisplayMode.cs
- AbstractExpressions.cs
- RepeatBehaviorConverter.cs
- ByeMessageCD1.cs
- PriorityQueue.cs
- Registry.cs
- PriorityQueue.cs
- CodeRemoveEventStatement.cs
- DeploymentSectionCache.cs
- StoreItemCollection.cs
- transactioncontext.cs
- FacetValues.cs
- DataError.cs
- OptimisticConcurrencyException.cs
- TemplateNodeContextMenu.cs
- MouseEvent.cs
- TokenBasedSet.cs
- DefaultBindingPropertyAttribute.cs
- BmpBitmapDecoder.cs
- TraceData.cs
- BufferBuilder.cs
- Pts.cs
- BamlRecordHelper.cs
- WebPartActionVerb.cs
- XmlSchemaExternal.cs
- CustomAttributeFormatException.cs
- BitmapData.cs
- TextEditorLists.cs
- DateTimeFormatInfoScanner.cs
- FormClosedEvent.cs
- KnownBoxes.cs
- ItemChangedEventArgs.cs
- Int32AnimationBase.cs
- SystemIcons.cs
- ServicePointManagerElement.cs