Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- MimePart.cs
- RenderingEventArgs.cs
- ConfigurationErrorsException.cs
- RoleGroupCollection.cs
- EdmToObjectNamespaceMap.cs
- CqlLexerHelpers.cs
- SmtpMail.cs
- KeyInterop.cs
- XsltQilFactory.cs
- RolePrincipal.cs
- PathStreamGeometryContext.cs
- DiagnosticStrings.cs
- OletxResourceManager.cs
- RadioButton.cs
- XmlTextReaderImpl.cs
- sqlstateclientmanager.cs
- TrackBarRenderer.cs
- TextWriterTraceListener.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- PreviewKeyDownEventArgs.cs
- EventLogStatus.cs
- DocumentGrid.cs
- HostProtectionException.cs
- DoubleLinkList.cs
- TableCellAutomationPeer.cs
- ServiceOperationHelpers.cs
- ChooseAction.cs
- FragmentNavigationEventArgs.cs
- MetadataArtifactLoader.cs
- CancellationHandlerDesigner.cs
- CodeDomConfigurationHandler.cs
- ToolStripButton.cs
- DataKeyArray.cs
- XmlImplementation.cs
- KeyValuePairs.cs
- WebSysDescriptionAttribute.cs
- HighContrastHelper.cs
- TextTreeUndo.cs
- Emitter.cs
- BitmapDecoder.cs
- CheckBox.cs
- CaseStatement.cs
- XmlCharCheckingWriter.cs
- XomlSerializationHelpers.cs
- XmlDataLoader.cs
- TextBox.cs
- SamlAttributeStatement.cs
- HttpClientCertificate.cs
- DecimalKeyFrameCollection.cs
- SchemaImporterExtension.cs
- EventLog.cs
- SerializationException.cs
- TraceSection.cs
- dbenumerator.cs
- UnsafeNetInfoNativeMethods.cs
- _NestedMultipleAsyncResult.cs
- AudioSignalProblemOccurredEventArgs.cs
- ObjectPropertyMapping.cs
- MouseButton.cs
- OpenFileDialog.cs
- VectorAnimation.cs
- BaseCollection.cs
- TextChangedEventArgs.cs
- ExpressionDumper.cs
- InfoCardArgumentException.cs
- IntegerFacetDescriptionElement.cs
- ImportDesigner.xaml.cs
- SerializationSectionGroup.cs
- WebResourceUtil.cs
- Context.cs
- ByteStorage.cs
- LogicalChannel.cs
- XmlSchemaProviderAttribute.cs
- AuthenticationService.cs
- XmlAttributeOverrides.cs
- HttpModuleAction.cs
- RectangleGeometry.cs
- HtmlInputCheckBox.cs
- NumberEdit.cs
- DSASignatureFormatter.cs
- CallTemplateAction.cs
- TransactionTable.cs
- ProfessionalColorTable.cs
- ImageMapEventArgs.cs
- NameValueCollection.cs
- ScrollBarRenderer.cs
- DelayedRegex.cs
- ProxyElement.cs
- SHA1.cs
- RSACryptoServiceProvider.cs
- HttpCacheParams.cs
- FlowDocumentPageViewerAutomationPeer.cs
- TargetConverter.cs
- ProcessInfo.cs
- FlowLayout.cs
- XmlSchemaInclude.cs
- BaseCAMarshaler.cs
- CodeSubDirectory.cs
- documentsequencetextview.cs
- Brush.cs