Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Common / EntityRecordInfo.cs / 2 / 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
- PowerModeChangedEventArgs.cs
- COM2EnumConverter.cs
- SharedStatics.cs
- ElementHostPropertyMap.cs
- ResXResourceWriter.cs
- PolicyImporterElementCollection.cs
- RuleSettings.cs
- XmlElementAttributes.cs
- ListenerHandler.cs
- SplineKeyFrames.cs
- MediaContextNotificationWindow.cs
- SectionInput.cs
- EntityContainer.cs
- OpenFileDialog.cs
- InvalidOleVariantTypeException.cs
- UInt16Converter.cs
- safemediahandle.cs
- ProviderSettingsCollection.cs
- AudioStateChangedEventArgs.cs
- CookieProtection.cs
- TraceData.cs
- HostSecurityManager.cs
- ClipboardData.cs
- ScriptControl.cs
- OleDbSchemaGuid.cs
- StorageScalarPropertyMapping.cs
- Geometry3D.cs
- EventDescriptor.cs
- _ListenerResponseStream.cs
- COM2ColorConverter.cs
- SkinBuilder.cs
- InitiatorSessionSymmetricMessageSecurityProtocol.cs
- PersonalizableAttribute.cs
- WebPartConnectionsConfigureVerb.cs
- SelectionPattern.cs
- MsmqPoisonMessageException.cs
- DetailsViewDeleteEventArgs.cs
- TdsValueSetter.cs
- EllipseGeometry.cs
- MobileControl.cs
- TransformerTypeCollection.cs
- QfeChecker.cs
- TableLayoutRowStyleCollection.cs
- SystemColors.cs
- KeyedHashAlgorithm.cs
- ObjectListShowCommandsEventArgs.cs
- _BaseOverlappedAsyncResult.cs
- WindowInteropHelper.cs
- OleDbTransaction.cs
- ProcessRequestArgs.cs
- BindingMemberInfo.cs
- PrePostDescendentsWalker.cs
- PartBasedPackageProperties.cs
- InheritanceAttribute.cs
- InternalUserCancelledException.cs
- DocumentPropertiesDialog.cs
- DataKeyArray.cs
- EntityDataSourceContainerNameConverter.cs
- Size3DConverter.cs
- ToolboxDataAttribute.cs
- SelectionListComponentEditor.cs
- ExpressionTextBoxAutomationPeer.cs
- SQLInt64Storage.cs
- DebuggerAttributes.cs
- XmlDictionaryString.cs
- sqlstateclientmanager.cs
- HostingEnvironmentException.cs
- Translator.cs
- TextDocumentView.cs
- LogEntryHeaderv1Deserializer.cs
- ToolStripDropDownClosedEventArgs.cs
- CompilationPass2TaskInternal.cs
- ListView.cs
- ControlUtil.cs
- FontClient.cs
- ChildTable.cs
- BindingMemberInfo.cs
- SevenBitStream.cs
- TriggerAction.cs
- ActiveXContainer.cs
- WindowsScrollBarBits.cs
- NativeMethods.cs
- StatusBarPanelClickEvent.cs
- ViewPort3D.cs
- DateTimeConstantAttribute.cs
- RotateTransform.cs
- QueryRewriter.cs
- Scanner.cs
- OdbcConnectionOpen.cs
- OdbcRowUpdatingEvent.cs
- FindSimilarActivitiesVerb.cs
- clipboard.cs
- PbrsForward.cs
- SecurityHelper.cs
- WebScriptEnablingElement.cs
- DeviceContext2.cs
- ColorPalette.cs
- ScrollBarAutomationPeer.cs
- GiveFeedbackEvent.cs
- DataGridViewColumnEventArgs.cs