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
- BufferedResponseStream.cs
- ProcessModelInfo.cs
- PropertyIDSet.cs
- CalendarDay.cs
- ReadOnlyHierarchicalDataSourceView.cs
- Highlights.cs
- UserPersonalizationStateInfo.cs
- BrowserCapabilitiesCompiler.cs
- Msec.cs
- Win32PrintDialog.cs
- TreeView.cs
- DatatypeImplementation.cs
- Soap.cs
- ParserStreamGeometryContext.cs
- FieldTemplateUserControl.cs
- XmlSerializableWriter.cs
- ConstraintCollection.cs
- Vector3DCollection.cs
- DoubleUtil.cs
- StatementContext.cs
- CollectionEditorDialog.cs
- AutomationIdentifier.cs
- WizardDesigner.cs
- ReliableChannelListener.cs
- XamlSerializerUtil.cs
- PassportPrincipal.cs
- GlyphRunDrawing.cs
- RegisteredDisposeScript.cs
- FilterElement.cs
- DocumentAutomationPeer.cs
- ByteAnimation.cs
- BamlRecordHelper.cs
- ObjectQueryProvider.cs
- GestureRecognizer.cs
- Table.cs
- CallSite.cs
- DefaultPropertyAttribute.cs
- DataGridViewColumnConverter.cs
- ToolboxItemWrapper.cs
- ProgressBarAutomationPeer.cs
- ForwardPositionQuery.cs
- MimeFormImporter.cs
- TableDetailsRow.cs
- DataGridViewColumn.cs
- ErrorFormatterPage.cs
- XhtmlBasicLinkAdapter.cs
- QueryStringParameter.cs
- JsonXmlDataContract.cs
- DataGridViewAdvancedBorderStyle.cs
- ProbeMatchesMessage11.cs
- SamlAudienceRestrictionCondition.cs
- PatternMatcher.cs
- TreeViewBindingsEditorForm.cs
- IISUnsafeMethods.cs
- ConfigurationSchemaErrors.cs
- regiisutil.cs
- HttpCacheVary.cs
- DecoderReplacementFallback.cs
- TemplateLookupAction.cs
- DataSourceConverter.cs
- TraceSwitch.cs
- CookieParameter.cs
- StringTraceRecord.cs
- XmlSchemaComplexContentRestriction.cs
- Common.cs
- ActivitySurrogateSelector.cs
- FlowLayoutSettings.cs
- EventTrigger.cs
- ColumnResizeUndoUnit.cs
- HMACSHA256.cs
- SerTrace.cs
- RenderingEventArgs.cs
- LongAverageAggregationOperator.cs
- ChannelPoolSettings.cs
- DataGridViewRowsRemovedEventArgs.cs
- MimeXmlImporter.cs
- RelationshipNavigation.cs
- SecurityElement.cs
- TypeInitializationException.cs
- CroppedBitmap.cs
- RepeatBehaviorConverter.cs
- DrawListViewColumnHeaderEventArgs.cs
- ScrollChrome.cs
- TabItem.cs
- StrongNameSignatureInformation.cs
- LoginDesignerUtil.cs
- documentation.cs
- ColumnBinding.cs
- ThrowHelper.cs
- ThaiBuddhistCalendar.cs
- SchemaLookupTable.cs
- VisualStateChangedEventArgs.cs
- RectangleGeometry.cs
- ToolBarButton.cs
- InheritanceService.cs
- TabControlCancelEvent.cs
- SymbolDocumentGenerator.cs
- _AcceptOverlappedAsyncResult.cs
- XmlDownloadManager.cs
- EmptyStringExpandableObjectConverter.cs