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 / Common / EntityRecordInfo.cs / 1 / EntityRecordInfo.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Common { using System.Data; using System.Collections.Generic; using System.Data.Metadata.Edm; using System.Diagnostics; ////// EntityRecordInfo class providing a simple way to access both the type information and the column information. /// public class EntityRecordInfo : DataRecordInfo { private readonly EntityKey _entityKey; private readonly EntitySet _entitySet; ////// /// /// /// /// public EntityRecordInfo(EntityType metadata, IEnumerablememberInfo, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata), memberInfo) { EntityUtil.CheckArgumentNull (entityKey, "entityKey"); EntityUtil.CheckArgumentNull(entitySet, "entitySet"); _entityKey = entityKey; _entitySet = entitySet; ValidateEntityType(entitySet); } /// /// /// /// /// internal EntityRecordInfo(EntityType metadata, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata)) { EntityUtil.CheckArgumentNull(entityKey, "entityKey"); _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } /// /// Reusing TypeUsage and FieldMetadata from another EntityRecordInfo which has all the same info /// but with a different EntityKey instance. /// internal EntityRecordInfo(DataRecordInfo info, EntityKey entityKey, EntitySet entitySet) : base(info) { _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } ////// the EntityKey /// public EntityKey EntityKey { get { return _entityKey; } } // using EntitySetBase versus EntitySet prevents the unnecessary cast of ElementType to EntityType private void ValidateEntityType(EntitySetBase entitySet) { if (!object.ReferenceEquals(RecordType.EdmType, null) && !object.ReferenceEquals(_entityKey, EntityKey.EntityNotValidKey) && !object.ReferenceEquals(_entityKey, EntityKey.NoEntitySetKey) && !object.ReferenceEquals(RecordType.EdmType, entitySet.ElementType) && !entitySet.ElementType.IsBaseTypeOf(RecordType.EdmType)) { throw EntityUtil.Argument(System.Data.Entity.Strings.EntityTypesDoNotAgree); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Common { using System.Data; using System.Collections.Generic; using System.Data.Metadata.Edm; using System.Diagnostics; ////// EntityRecordInfo class providing a simple way to access both the type information and the column information. /// public class EntityRecordInfo : DataRecordInfo { private readonly EntityKey _entityKey; private readonly EntitySet _entitySet; ////// /// /// /// /// public EntityRecordInfo(EntityType metadata, IEnumerablememberInfo, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata), memberInfo) { EntityUtil.CheckArgumentNull (entityKey, "entityKey"); EntityUtil.CheckArgumentNull(entitySet, "entitySet"); _entityKey = entityKey; _entitySet = entitySet; ValidateEntityType(entitySet); } /// /// /// /// /// internal EntityRecordInfo(EntityType metadata, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata)) { EntityUtil.CheckArgumentNull(entityKey, "entityKey"); _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } /// /// Reusing TypeUsage and FieldMetadata from another EntityRecordInfo which has all the same info /// but with a different EntityKey instance. /// internal EntityRecordInfo(DataRecordInfo info, EntityKey entityKey, EntitySet entitySet) : base(info) { _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } ////// the EntityKey /// public EntityKey EntityKey { get { return _entityKey; } } // using EntitySetBase versus EntitySet prevents the unnecessary cast of ElementType to EntityType private void ValidateEntityType(EntitySetBase entitySet) { if (!object.ReferenceEquals(RecordType.EdmType, null) && !object.ReferenceEquals(_entityKey, EntityKey.EntityNotValidKey) && !object.ReferenceEquals(_entityKey, EntityKey.NoEntitySetKey) && !object.ReferenceEquals(RecordType.EdmType, entitySet.ElementType) && !entitySet.ElementType.IsBaseTypeOf(RecordType.EdmType)) { throw EntityUtil.Argument(System.Data.Entity.Strings.EntityTypesDoNotAgree); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CategoryGridEntry.cs
- _UriTypeConverter.cs
- GroupBoxAutomationPeer.cs
- KnownTypes.cs
- MenuItem.cs
- DBSchemaRow.cs
- DataViewSetting.cs
- SafeEventLogReadHandle.cs
- XmlDocumentType.cs
- DescriptionAttribute.cs
- HandlerElementCollection.cs
- MenuItemBindingCollection.cs
- XamlSerializerUtil.cs
- Ray3DHitTestResult.cs
- TouchEventArgs.cs
- PersonalizableAttribute.cs
- RectAnimationClockResource.cs
- Logging.cs
- ChannelAcceptor.cs
- DigestTraceRecordHelper.cs
- MobileControlsSection.cs
- AttachmentCollection.cs
- PresentationSource.cs
- SByteStorage.cs
- X509CertificateChain.cs
- TextBoxView.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- PenContexts.cs
- DataGridCommandEventArgs.cs
- XmlObjectSerializerReadContextComplex.cs
- BaseDataListComponentEditor.cs
- ContentWrapperAttribute.cs
- AttributeProviderAttribute.cs
- VarInfo.cs
- _SecureChannel.cs
- ContentType.cs
- VirtualPathUtility.cs
- WindowAutomationPeer.cs
- XmlElementAttribute.cs
- BamlMapTable.cs
- HwndPanningFeedback.cs
- StyleHelper.cs
- OleAutBinder.cs
- Grant.cs
- IdentitySection.cs
- TimeStampChecker.cs
- TraversalRequest.cs
- DispatcherTimer.cs
- EntryIndex.cs
- ValueChangedEventManager.cs
- ResourceReferenceKeyNotFoundException.cs
- TreeNodeCollection.cs
- EventArgs.cs
- XmlSerializerAssemblyAttribute.cs
- xmlsaver.cs
- Win32Exception.cs
- XmlElement.cs
- EditorPartDesigner.cs
- InlineUIContainer.cs
- XmlDataProvider.cs
- PartManifestEntry.cs
- ISFClipboardData.cs
- ResumeStoryboard.cs
- ArgIterator.cs
- Tablet.cs
- BinaryFormatterWriter.cs
- InputScopeAttribute.cs
- XamlBuildProvider.cs
- PropertyGeneratedEventArgs.cs
- EncodingStreamWrapper.cs
- DBSchemaTable.cs
- IgnoreFileBuildProvider.cs
- SynchronizedInputPattern.cs
- ObjectTag.cs
- Calendar.cs
- Size3DConverter.cs
- LineVisual.cs
- securitycriticaldataClass.cs
- CheckBoxFlatAdapter.cs
- ComPersistableTypeElement.cs
- ServiceElement.cs
- WindowsSspiNegotiation.cs
- SqlBinder.cs
- DataGridViewButtonColumn.cs
- StickyNoteHelper.cs
- TextElementEnumerator.cs
- NetSectionGroup.cs
- ComboBoxHelper.cs
- WrapPanel.cs
- _ScatterGatherBuffers.cs
- LowerCaseStringConverter.cs
- Process.cs
- FormViewInsertEventArgs.cs
- ResourcePool.cs
- WindowHelperService.cs
- Base64Encoder.cs
- UriWriter.cs
- ElementMarkupObject.cs
- ACE.cs
- _ListenerResponseStream.cs