Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- TextLineResult.cs
- CheckBoxPopupAdapter.cs
- PrePrepareMethodAttribute.cs
- PasswordBoxAutomationPeer.cs
- TextMarkerSource.cs
- SplitterCancelEvent.cs
- HMACSHA384.cs
- Win32Native.cs
- TextParagraph.cs
- __Filters.cs
- DetailsViewDeleteEventArgs.cs
- DataServiceQueryOfT.cs
- CacheVirtualItemsEvent.cs
- CryptoConfig.cs
- IEnumerable.cs
- SqlDataSourceCache.cs
- AddInServer.cs
- GridViewEditEventArgs.cs
- MsmqInputMessagePool.cs
- ParamArrayAttribute.cs
- DynamicDocumentPaginator.cs
- CSharpCodeProvider.cs
- ProfileSettings.cs
- FontDriver.cs
- PrivateFontCollection.cs
- DataGridViewSortCompareEventArgs.cs
- ProxyElement.cs
- ObjectDataSourceStatusEventArgs.cs
- IsolationInterop.cs
- ReceiveMessageAndVerifySecurityAsyncResultBase.cs
- TogglePattern.cs
- ClientTarget.cs
- PriorityQueue.cs
- UserControlCodeDomTreeGenerator.cs
- XmlSchemaProviderAttribute.cs
- EventLogStatus.cs
- CodeVariableDeclarationStatement.cs
- InfoCardCryptoHelper.cs
- PathParser.cs
- FrugalList.cs
- UshortList2.cs
- EntityWrapperFactory.cs
- PolyBezierSegment.cs
- KnownTypes.cs
- ToolStripControlHost.cs
- MaterialGroup.cs
- FastEncoder.cs
- TextParagraphView.cs
- DrawingAttributeSerializer.cs
- RectAnimationUsingKeyFrames.cs
- WhitespaceRule.cs
- Trigger.cs
- CFGGrammar.cs
- MediaTimeline.cs
- CFStream.cs
- PrintDialogDesigner.cs
- AnimationException.cs
- NestedContainer.cs
- SqlNotificationEventArgs.cs
- X509CertificateChain.cs
- StretchValidation.cs
- Select.cs
- ExpressionTextBox.xaml.cs
- SchemaMerger.cs
- TTSEvent.cs
- SqlFacetAttribute.cs
- VisualStyleElement.cs
- ClientTargetCollection.cs
- InputBinder.cs
- ToolStripComboBox.cs
- MemberExpression.cs
- ReflectionPermission.cs
- WhiteSpaceTrimStringConverter.cs
- EntityDataSourceViewSchema.cs
- RowToParametersTransformer.cs
- DataGridViewComboBoxColumn.cs
- WorkflowDesignerColors.cs
- ColorMap.cs
- QueuePropertyVariants.cs
- AssertHelper.cs
- TdsEnums.cs
- WpfSharedBamlSchemaContext.cs
- SessionIDManager.cs
- XmlName.cs
- DataGridTableStyleMappingNameEditor.cs
- NumberSubstitution.cs
- SuppressMergeCheckAttribute.cs
- iisPickupDirectory.cs
- CheckedListBox.cs
- CompareInfo.cs
- UnknownBitmapEncoder.cs
- WebPartDisplayModeCollection.cs
- SimpleLine.cs
- DSASignatureDeformatter.cs
- ConfigurationException.cs
- CapabilitiesPattern.cs
- ExceptionHelpers.cs
- SslStreamSecurityElement.cs
- StringUtil.cs
- ScriptingRoleServiceSection.cs