Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / SchemaElementLookUpTable.cs / 1305376 / 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
- HashAlgorithm.cs
- VectorConverter.cs
- ConfigurationSection.cs
- XmlValueConverter.cs
- ProfileSettingsCollection.cs
- SpeechSeg.cs
- ItemMap.cs
- _IPv6Address.cs
- DelegatedStream.cs
- SynchronousSendBindingElement.cs
- OracleNumber.cs
- EllipseGeometry.cs
- CompressionTransform.cs
- PermissionToken.cs
- PageThemeBuildProvider.cs
- WindowProviderWrapper.cs
- XmlSignatureManifest.cs
- TextView.cs
- StringDictionaryCodeDomSerializer.cs
- SqlRowUpdatingEvent.cs
- TrackingExtract.cs
- PagedDataSource.cs
- DataGridViewColumnTypePicker.cs
- FormClosedEvent.cs
- WindowsIPAddress.cs
- PointValueSerializer.cs
- PrintController.cs
- WmlMobileTextWriter.cs
- TableTextElementCollectionInternal.cs
- SchemaCollectionPreprocessor.cs
- SqlGenericUtil.cs
- NavigateEvent.cs
- ProfileService.cs
- RegexFCD.cs
- PageAsyncTaskManager.cs
- TextFormatterHost.cs
- MarkupCompilePass2.cs
- FontStyles.cs
- StylusButtonEventArgs.cs
- ScanQueryOperator.cs
- TargetFrameworkAttribute.cs
- TextTreePropertyUndoUnit.cs
- InfoCardSymmetricAlgorithm.cs
- NativeCompoundFileAPIs.cs
- ContextMarshalException.cs
- CommandArguments.cs
- DecoderNLS.cs
- Vector3DCollectionConverter.cs
- TryLoadRunnableWorkflowCommand.cs
- WebPartManagerInternals.cs
- TabletDevice.cs
- PackagePart.cs
- TextTreeText.cs
- relpropertyhelper.cs
- ValueType.cs
- Transform.cs
- PropertyCondition.cs
- CodeTypeOfExpression.cs
- NativeMethods.cs
- TextDecorationCollectionConverter.cs
- MSAANativeProvider.cs
- SqlBooleanizer.cs
- CodeAccessPermission.cs
- MailHeaderInfo.cs
- CompiledQueryCacheKey.cs
- _IPv6Address.cs
- Select.cs
- SizeChangedEventArgs.cs
- PolicyStatement.cs
- Positioning.cs
- WebHttpBindingCollectionElement.cs
- EncryptedPackageFilter.cs
- SectionInformation.cs
- GeometryValueSerializer.cs
- MessagePartSpecification.cs
- XPathAxisIterator.cs
- SmiEventSink_Default.cs
- AuthenticationConfig.cs
- ColorConvertedBitmapExtension.cs
- DrawingState.cs
- DescriptionAttribute.cs
- ExtensionFile.cs
- IndexedSelectQueryOperator.cs
- XmlSerializerFaultFormatter.cs
- XsdBuilder.cs
- ScopelessEnumAttribute.cs
- WmlLinkAdapter.cs
- Perspective.cs
- UIElement3DAutomationPeer.cs
- TransactionException.cs
- SafeMILHandleMemoryPressure.cs
- MetadataProperty.cs
- RootBrowserWindow.cs
- TextStore.cs
- ResourcePermissionBaseEntry.cs
- ToolStripSeparator.cs
- XmlSchemaNotation.cs
- Logging.cs
- ADMembershipProvider.cs
- EntitySqlException.cs