Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Objects / ObjectStateEntryDbUpdatableDataRecord.cs / 1305376 / ObjectStateEntryDbUpdatableDataRecord.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Data.Metadata.Edm; using System.Data.Objects; using System.Diagnostics; using System.Reflection; namespace System.Data.Objects { internal sealed class ObjectStateEntryDbUpdatableDataRecord : CurrentValueRecord { internal ObjectStateEntryDbUpdatableDataRecord(EntityEntry cacheEntry, StateManagerTypeMetadata metadata, object userObject) : base(cacheEntry, metadata, userObject) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); EntityUtil.CheckArgumentNull(userObject, "userObject"); EntityUtil.CheckArgumentNull(metadata, "metadata"); Debug.Assert(!cacheEntry.IsKeyEntry, "Cannot create an ObjectStateEntryDbUpdatableDataRecord for a key entry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } internal ObjectStateEntryDbUpdatableDataRecord(RelationshipEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return (_cacheEntry as RelationshipEntry).GetCurrentRelationValue(ordinal); } else { return (_cacheEntry as EntityEntry).GetCurrentEntityValue(_metadata, ordinal, _userObject, ObjectStateValueRecord.CurrentUpdatable); } } protected override void SetRecordValue(int ordinal, object value) { if (_cacheEntry.IsRelationship) { // Cannot modify relation values from the public API throw EntityUtil.CantModifyRelationValues(); } else { (_cacheEntry as EntityEntry).SetCurrentEntityValue(_metadata, ordinal, _userObject, value); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Data.Metadata.Edm; using System.Data.Objects; using System.Diagnostics; using System.Reflection; namespace System.Data.Objects { internal sealed class ObjectStateEntryDbUpdatableDataRecord : CurrentValueRecord { internal ObjectStateEntryDbUpdatableDataRecord(EntityEntry cacheEntry, StateManagerTypeMetadata metadata, object userObject) : base(cacheEntry, metadata, userObject) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); EntityUtil.CheckArgumentNull(userObject, "userObject"); EntityUtil.CheckArgumentNull(metadata, "metadata"); Debug.Assert(!cacheEntry.IsKeyEntry, "Cannot create an ObjectStateEntryDbUpdatableDataRecord for a key entry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } internal ObjectStateEntryDbUpdatableDataRecord(RelationshipEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return (_cacheEntry as RelationshipEntry).GetCurrentRelationValue(ordinal); } else { return (_cacheEntry as EntityEntry).GetCurrentEntityValue(_metadata, ordinal, _userObject, ObjectStateValueRecord.CurrentUpdatable); } } protected override void SetRecordValue(int ordinal, object value) { if (_cacheEntry.IsRelationship) { // Cannot modify relation values from the public API throw EntityUtil.CantModifyRelationValues(); } else { (_cacheEntry as EntityEntry).SetCurrentEntityValue(_metadata, ordinal, _userObject, value); } } } } // 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
- HttpWriter.cs
- ExpressionVisitorHelpers.cs
- ThrowHelper.cs
- XmlElementAttribute.cs
- CodeSubDirectoriesCollection.cs
- CustomPeerResolverService.cs
- TdsParserSessionPool.cs
- DataSourceControlBuilder.cs
- ClockController.cs
- StartUpEventArgs.cs
- _emptywebproxy.cs
- HtmlTableCell.cs
- Timer.cs
- Drawing.cs
- UriWriter.cs
- ImageUrlEditor.cs
- ToolTipService.cs
- MetadataFile.cs
- SingleBodyParameterMessageFormatter.cs
- X509Certificate2.cs
- Menu.cs
- AspCompat.cs
- BlockUIContainer.cs
- SQLInt16.cs
- FrameworkContentElement.cs
- SimpleTypeResolver.cs
- HandlerWithFactory.cs
- RenderOptions.cs
- BrushMappingModeValidation.cs
- HttpFileCollection.cs
- DocumentXPathNavigator.cs
- FixedSOMPageElement.cs
- ControlCachePolicy.cs
- SslStream.cs
- SecurityIdentifierElement.cs
- XPathAncestorIterator.cs
- rsa.cs
- Translator.cs
- AbstractDataSvcMapFileLoader.cs
- Geometry3D.cs
- AssociationSetMetadata.cs
- ScriptResourceAttribute.cs
- RegexTree.cs
- AssemblyFilter.cs
- ReadOnlyTernaryTree.cs
- Viewport3DAutomationPeer.cs
- WmfPlaceableFileHeader.cs
- HostingEnvironment.cs
- CodeNamespaceImport.cs
- ColumnResult.cs
- DocumentXmlWriter.cs
- SqlMethodCallConverter.cs
- CloudCollection.cs
- EntityClassGenerator.cs
- DateTimePickerDesigner.cs
- ConfigurationElementProperty.cs
- WeakHashtable.cs
- TextTreeUndoUnit.cs
- HMACSHA512.cs
- GeneralTransform3DTo2D.cs
- RangeValueProviderWrapper.cs
- AttributeQuery.cs
- CountAggregationOperator.cs
- MultiAsyncResult.cs
- SingleConverter.cs
- TraceLevelStore.cs
- WebPartHeaderCloseVerb.cs
- Sentence.cs
- CompilerLocalReference.cs
- UIElementParagraph.cs
- GenericRootAutomationPeer.cs
- StorageMappingFragment.cs
- LayoutUtils.cs
- GridViewCancelEditEventArgs.cs
- ProtocolsConfiguration.cs
- DataKey.cs
- WebZone.cs
- PolicyUnit.cs
- OleDbConnectionInternal.cs
- TabControlEvent.cs
- RenderingBiasValidation.cs
- AssertUtility.cs
- MimeMultiPart.cs
- CollectionContainer.cs
- TypeContext.cs
- DataControlCommands.cs
- AsyncOperationManager.cs
- Mappings.cs
- UpdateException.cs
- DrawListViewSubItemEventArgs.cs
- COAUTHINFO.cs
- CancellableEnumerable.cs
- RootBuilder.cs
- Models.cs
- ServiceChannelFactory.cs
- securitymgrsite.cs
- DataGridViewCheckBoxColumn.cs
- FilteredSchemaElementLookUpTable.cs
- ValidationError.cs
- COM2FontConverter.cs