Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / EntityRecordInfo.cs / 1305376 / 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
- Processor.cs
- PageContent.cs
- ProbeMatchesMessage11.cs
- SpotLight.cs
- SerialReceived.cs
- OrderPreservingSpoolingTask.cs
- HtmlTable.cs
- OutputScopeManager.cs
- StringDictionary.cs
- _UncName.cs
- OptimalTextSource.cs
- Attachment.cs
- Base64Stream.cs
- QilXmlReader.cs
- ActionMismatchAddressingException.cs
- ParserExtension.cs
- ModuleConfigurationInfo.cs
- QualifierSet.cs
- EllipticalNodeOperations.cs
- SafeNativeMethods.cs
- AssertFilter.cs
- HttpAsyncResult.cs
- SignatureToken.cs
- AccessControlList.cs
- CLRBindingWorker.cs
- OleDbDataReader.cs
- ObservableDictionary.cs
- SelectionEditor.cs
- RuleSettings.cs
- StringReader.cs
- ConfigXmlWhitespace.cs
- MonitorWrapper.cs
- ContentHostHelper.cs
- RelatedPropertyManager.cs
- InternalConfigRoot.cs
- ValidatingReaderNodeData.cs
- UIElement.cs
- FaultHandlingFilter.cs
- InputLangChangeRequestEvent.cs
- CrossAppDomainChannel.cs
- TrustLevelCollection.cs
- ClientBuildManagerCallback.cs
- SecurityImpersonationBehavior.cs
- TemplateBindingExtension.cs
- IssuanceLicense.cs
- X509Utils.cs
- PermissionSet.cs
- SponsorHelper.cs
- Typography.cs
- TextRangeSerialization.cs
- FlowDocumentView.cs
- Parallel.cs
- CodeIndexerExpression.cs
- ResourceSet.cs
- ValueUtilsSmi.cs
- BaseDataList.cs
- ProviderSettingsCollection.cs
- EntityStoreSchemaFilterEntry.cs
- CollectionContainer.cs
- EdmMember.cs
- FreezableCollection.cs
- GridViewCancelEditEventArgs.cs
- PointCollection.cs
- SelectQueryOperator.cs
- SHA512.cs
- DoubleLink.cs
- RuleSetBrowserDialog.cs
- HttpPostedFile.cs
- FormsAuthenticationUser.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- ProcessingInstructionAction.cs
- EntityViewGenerator.cs
- SafeNativeMethods.cs
- EventProxy.cs
- QilName.cs
- QilSortKey.cs
- AstTree.cs
- Point.cs
- SamlAudienceRestrictionCondition.cs
- GraphicsContainer.cs
- SafePEFileHandle.cs
- VirtualPathProvider.cs
- RuntimeConfigLKG.cs
- NullEntityWrapper.cs
- SchemaElement.cs
- ByteStreamGeometryContext.cs
- FlowLayoutPanelDesigner.cs
- LineInfo.cs
- HitTestFilterBehavior.cs
- ActiveXHost.cs
- clipboard.cs
- cryptoapiTransform.cs
- RightsController.cs
- categoryentry.cs
- Internal.cs
- ValidationPropertyAttribute.cs
- ListBox.cs
- StackOverflowException.cs
- StatusBarPanel.cs
- PackUriHelper.cs