Code:
/ 4.0 / 4.0 / 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
- Clock.cs
- ModifierKeysValueSerializer.cs
- GACMembershipCondition.cs
- TextElementCollection.cs
- WindowsClaimSet.cs
- ConnectionOrientedTransportElement.cs
- DataServiceSaveChangesEventArgs.cs
- StreamMarshaler.cs
- AssociationSetEnd.cs
- Attributes.cs
- ZoneButton.cs
- MergePropertyDescriptor.cs
- MatrixTransform.cs
- NavigationService.cs
- XmlHierarchicalEnumerable.cs
- BaseDataBoundControl.cs
- BamlBinaryWriter.cs
- SqlServices.cs
- path.cs
- FontStyle.cs
- Deserializer.cs
- EmbossBitmapEffect.cs
- SQLBinaryStorage.cs
- MessageQueueKey.cs
- EntityConnection.cs
- XmlExpressionDumper.cs
- PackageDigitalSignature.cs
- DbTransaction.cs
- Propagator.JoinPropagator.SubstitutingCloneVisitor.cs
- CodeDirectiveCollection.cs
- PageStatePersister.cs
- TextTreeDeleteContentUndoUnit.cs
- MimeBasePart.cs
- TraceData.cs
- SamlAssertion.cs
- TemplateBamlRecordReader.cs
- InfoCardX509Validator.cs
- Attachment.cs
- StructuralComparisons.cs
- QilParameter.cs
- SelectionGlyphBase.cs
- SelectionWordBreaker.cs
- SoapAttributeOverrides.cs
- PathData.cs
- ListViewTableCell.cs
- BufferCache.cs
- DependencyPropertyAttribute.cs
- StateDesigner.Layouts.cs
- Pair.cs
- DataAdapter.cs
- DocumentReferenceCollection.cs
- ContentHostHelper.cs
- Rect.cs
- DbSource.cs
- Range.cs
- ResourcePart.cs
- HttpContext.cs
- BitmapInitialize.cs
- IndentedTextWriter.cs
- MergeLocalizationDirectives.cs
- ChildChangedEventArgs.cs
- CodeAssignStatement.cs
- SolidColorBrush.cs
- SiteMapSection.cs
- ProfileProvider.cs
- Int16Converter.cs
- FlowDocument.cs
- FormsIdentity.cs
- TextEditorSpelling.cs
- AstNode.cs
- ProcessHostServerConfig.cs
- ItemContainerPattern.cs
- LifetimeServices.cs
- BufferedGraphics.cs
- DataGridHeaderBorder.cs
- Validator.cs
- Pts.cs
- XsltSettings.cs
- HiddenField.cs
- StyleBamlRecordReader.cs
- XmlSortKey.cs
- _SslStream.cs
- ProxyHelper.cs
- CopyCodeAction.cs
- DoubleLinkList.cs
- DataGridViewCellMouseEventArgs.cs
- TextCompositionEventArgs.cs
- ProfilePropertyMetadata.cs
- ByteAnimationUsingKeyFrames.cs
- StorageRoot.cs
- XamlDesignerSerializationManager.cs
- HwndSourceParameters.cs
- IItemContainerGenerator.cs
- DataTableClearEvent.cs
- GridViewAutomationPeer.cs
- DiscoveryClientDuplexChannel.cs
- TransactionChannel.cs
- HitTestWithGeometryDrawingContextWalker.cs
- SymLanguageVendor.cs
- ObjectStateFormatter.cs