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
- Hashtable.cs
- LocatorBase.cs
- SqlMethods.cs
- ComplexBindingPropertiesAttribute.cs
- Timer.cs
- WebReferencesBuildProvider.cs
- DataMemberFieldConverter.cs
- RequestTimeoutManager.cs
- StringPropertyBuilder.cs
- PrivilegedConfigurationManager.cs
- DBConnection.cs
- DBConcurrencyException.cs
- DockAndAnchorLayout.cs
- Overlapped.cs
- AutomationProperties.cs
- TransformerInfo.cs
- odbcmetadatacolumnnames.cs
- CompressStream.cs
- SerialErrors.cs
- DbBuffer.cs
- KeySpline.cs
- RequestStatusBarUpdateEventArgs.cs
- WebPartZone.cs
- IPEndPoint.cs
- ProcessHostMapPath.cs
- TaskHelper.cs
- ObjectDataSourceStatusEventArgs.cs
- CommandTreeTypeHelper.cs
- ConvertBinder.cs
- UIElementIsland.cs
- ProcessInfo.cs
- ConfigXmlWhitespace.cs
- XmlCharacterData.cs
- CustomPopupPlacement.cs
- RegexNode.cs
- SaveFileDialog.cs
- PersistenceException.cs
- XsdBuilder.cs
- _NtlmClient.cs
- HashMembershipCondition.cs
- ProjectionPath.cs
- XmlDataLoader.cs
- DispatcherProcessingDisabled.cs
- EmptyElement.cs
- SafeNativeMemoryHandle.cs
- PreviewPageInfo.cs
- ExpressionBuilder.cs
- TileModeValidation.cs
- ReachPageContentSerializerAsync.cs
- FreezableOperations.cs
- RichTextBox.cs
- HttpCookie.cs
- CompositeActivityTypeDescriptorProvider.cs
- ViewStateModeByIdAttribute.cs
- PasswordPropertyTextAttribute.cs
- ProviderConnectionPointCollection.cs
- MulticastDelegate.cs
- SoapObjectWriter.cs
- MediaPlayerState.cs
- Model3D.cs
- BitmapEffectGroup.cs
- RequestCachingSection.cs
- FlowDocumentReader.cs
- TextParaLineResult.cs
- GeneralTransform.cs
- TrustExchangeException.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- TrustManagerMoreInformation.cs
- DeadCharTextComposition.cs
- DifferencingCollection.cs
- SqlCommand.cs
- MultiSelector.cs
- XmlBaseReader.cs
- LineServicesRun.cs
- NamespaceDecl.cs
- KeyEvent.cs
- ShapingEngine.cs
- SqlConnectionFactory.cs
- ReflectionServiceProvider.cs
- FileFormatException.cs
- AffineTransform3D.cs
- AnimationTimeline.cs
- XmlAutoDetectWriter.cs
- MappingItemCollection.cs
- CodeGroup.cs
- WebSysDisplayNameAttribute.cs
- ExecutionEngineException.cs
- Drawing.cs
- EventToken.cs
- SettingsBase.cs
- MailAddressCollection.cs
- NegatedCellConstant.cs
- CodeDirectionExpression.cs
- SvcMapFileLoader.cs
- LineServicesCallbacks.cs
- ToolStripItemRenderEventArgs.cs
- SystemIPv4InterfaceProperties.cs
- DesignerActionUIService.cs
- DuplicateWaitObjectException.cs
- RemotingHelper.cs