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
- TextServicesManager.cs
- BoundField.cs
- SqlGenericUtil.cs
- ShutDownListener.cs
- CopyAttributesAction.cs
- WebPartEditorApplyVerb.cs
- ReflectionServiceProvider.cs
- TextSearch.cs
- SynchronizationValidator.cs
- TrustLevel.cs
- BindingListCollectionView.cs
- LoadMessageLogger.cs
- PrincipalPermission.cs
- ExpressionHelper.cs
- OleDbEnumerator.cs
- DefaultPropertyAttribute.cs
- TearOffProxy.cs
- WCFModelStrings.Designer.cs
- StorageEntitySetMapping.cs
- SystemResourceHost.cs
- HttpFileCollection.cs
- SmtpReplyReader.cs
- WindowsSecurityTokenAuthenticator.cs
- WinCategoryAttribute.cs
- XmlSchemaCollection.cs
- LocalizationParserHooks.cs
- UserControlBuildProvider.cs
- FixedSOMPage.cs
- RoleService.cs
- PerfService.cs
- PermissionSetEnumerator.cs
- SafeMarshalContext.cs
- DocumentOrderQuery.cs
- GPPOINTF.cs
- RIPEMD160.cs
- LiteralText.cs
- ShapeTypeface.cs
- TextServicesProperty.cs
- CanonicalXml.cs
- Win32PrintDialog.cs
- TextDecorationCollectionConverter.cs
- NamespaceList.cs
- EditBehavior.cs
- XmlSignificantWhitespace.cs
- Html32TextWriter.cs
- HtmlButton.cs
- ComIntegrationManifestGenerator.cs
- RegexBoyerMoore.cs
- AuthenticationConfig.cs
- InputEventArgs.cs
- WebConfigurationHost.cs
- XmlUrlEditor.cs
- SettingsPropertyWrongTypeException.cs
- DirectoryLocalQuery.cs
- ExpressionsCollectionConverter.cs
- AdvancedBindingPropertyDescriptor.cs
- _KerberosClient.cs
- SplashScreenNativeMethods.cs
- WebRequestModuleElement.cs
- PersonalizablePropertyEntry.cs
- XmlWellformedWriter.cs
- _ScatterGatherBuffers.cs
- MediaElement.cs
- StoreContentChangedEventArgs.cs
- LogStream.cs
- HttpRequest.cs
- SafeNativeMethods.cs
- FlowDocumentReader.cs
- MetadataItem_Static.cs
- SystemIPGlobalProperties.cs
- NavigationExpr.cs
- TableRowCollection.cs
- ISCIIEncoding.cs
- _ListenerAsyncResult.cs
- PartitionedStream.cs
- RegisteredDisposeScript.cs
- CapabilitiesUse.cs
- OutputCacheSettings.cs
- XmlSchemaCollection.cs
- ConfigurationPropertyCollection.cs
- EntityType.cs
- ControlCollection.cs
- MdImport.cs
- FileSystemEventArgs.cs
- LineGeometry.cs
- DataBindingCollectionConverter.cs
- ChtmlTextWriter.cs
- SqlException.cs
- ToolBarButtonDesigner.cs
- DependencySource.cs
- BitmapPalettes.cs
- CodeAttributeDeclarationCollection.cs
- EventDescriptor.cs
- SoapElementAttribute.cs
- WebControlsSection.cs
- SByteConverter.cs
- MarshalByRefObject.cs
- InputBuffer.cs
- PropertyDescriptorComparer.cs
- contentDescriptor.cs