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
- DataGridRelationshipRow.cs
- BamlStream.cs
- DefaultDialogButtons.cs
- DataGridViewBindingCompleteEventArgs.cs
- __Filters.cs
- Int64KeyFrameCollection.cs
- QilStrConcat.cs
- DataGridViewCellPaintingEventArgs.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- EventLogPermissionAttribute.cs
- SplitContainer.cs
- FileStream.cs
- Lookup.cs
- Dump.cs
- DecoderBestFitFallback.cs
- DataControlHelper.cs
- CompilationUtil.cs
- MatrixKeyFrameCollection.cs
- FileDetails.cs
- ItemType.cs
- FamilyMap.cs
- StorageAssociationTypeMapping.cs
- BufferModesCollection.cs
- TextBounds.cs
- CallInfo.cs
- UnsafeNativeMethods.cs
- ListItem.cs
- Group.cs
- HMACSHA1.cs
- TemplateParser.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- StringDictionary.cs
- ParallelActivityDesigner.cs
- TextInfo.cs
- IntPtr.cs
- TableCellAutomationPeer.cs
- BinaryUtilClasses.cs
- InputScopeNameConverter.cs
- PieceDirectory.cs
- BitmapEffectDrawingContextWalker.cs
- SqlDataSourceQueryEditor.cs
- DoubleCollectionValueSerializer.cs
- CodeStatementCollection.cs
- COM2Enum.cs
- Conditional.cs
- DoubleAnimationBase.cs
- MaterialGroup.cs
- SessionStateItemCollection.cs
- PropertyPath.cs
- ToolStripItemCollection.cs
- EditorPartChrome.cs
- CngAlgorithmGroup.cs
- IntegerFacetDescriptionElement.cs
- MarshalByRefObject.cs
- OleDbDataReader.cs
- CqlParser.cs
- UIPermission.cs
- StringArrayConverter.cs
- BaseAppDomainProtocolHandler.cs
- Message.cs
- Vars.cs
- DataGridItemEventArgs.cs
- DataGridPagerStyle.cs
- DocumentGrid.cs
- SamlAction.cs
- PersianCalendar.cs
- InfoCardUIAgent.cs
- ControlBindingsConverter.cs
- _DisconnectOverlappedAsyncResult.cs
- OrderedDictionary.cs
- OAVariantLib.cs
- ToolZone.cs
- PermissionRequestEvidence.cs
- HashHelpers.cs
- SettingsContext.cs
- TextRunTypographyProperties.cs
- EndpointFilterProvider.cs
- PropertyRecord.cs
- NamespaceList.cs
- ItemCollection.cs
- MethodCallTranslator.cs
- PropagatorResult.cs
- AsymmetricSignatureDeformatter.cs
- QueryContinueDragEventArgs.cs
- TextLine.cs
- CustomWebEventKey.cs
- DataGridViewMethods.cs
- Calendar.cs
- Triangle.cs
- SymLanguageVendor.cs
- Roles.cs
- ExpressionBinding.cs
- FrameworkObject.cs
- DataBinder.cs
- ToolBarButtonClickEvent.cs
- RegexCaptureCollection.cs
- XsltConvert.cs
- SmiXetterAccessMap.cs
- FixedSOMLineCollection.cs
- StateRuntime.cs