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
- PtsHelper.cs
- SecurityResources.cs
- SqlParameterizer.cs
- MergeEnumerator.cs
- SiteMapNode.cs
- HtmlTableRowCollection.cs
- CellCreator.cs
- ImageCodecInfo.cs
- PeerCollaboration.cs
- ProgressBarRenderer.cs
- DetailsViewPagerRow.cs
- _LocalDataStoreMgr.cs
- KnownAssembliesSet.cs
- CollectionChange.cs
- ToolStripSystemRenderer.cs
- ApplicationFileParser.cs
- X509Utils.cs
- HtmlDocument.cs
- Transform.cs
- Transform.cs
- CalendarKeyboardHelper.cs
- StorageEntityTypeMapping.cs
- SqlConnectionStringBuilder.cs
- ObjectDataSourceFilteringEventArgs.cs
- WebPartDeleteVerb.cs
- CompositeClientFormatter.cs
- OdbcConnectionString.cs
- SqlProviderServices.cs
- RuntimeEnvironment.cs
- WebPartDescription.cs
- Validator.cs
- WebPartConnection.cs
- TrustManagerPromptUI.cs
- DiffuseMaterial.cs
- OutputCacheSettings.cs
- NativeWindow.cs
- ClientSession.cs
- GridViewRowPresenter.cs
- SendActivity.cs
- DPAPIProtectedConfigurationProvider.cs
- ListenerSessionConnectionReader.cs
- Translator.cs
- DataGridViewRow.cs
- ToolStripButton.cs
- DataGridItemCollection.cs
- MinMaxParagraphWidth.cs
- TokenizerHelper.cs
- UIElementParagraph.cs
- PopupEventArgs.cs
- FormClosedEvent.cs
- MissingSatelliteAssemblyException.cs
- ColumnWidthChangingEvent.cs
- WebPartConnectionsConfigureVerb.cs
- Screen.cs
- PolygonHotSpot.cs
- Label.cs
- ItemsControl.cs
- StrokeNodeEnumerator.cs
- ExceptionAggregator.cs
- ModuleConfigurationInfo.cs
- StyleModeStack.cs
- RectangleHotSpot.cs
- DateTimeUtil.cs
- GuidelineCollection.cs
- ApplicationDirectory.cs
- QueryStringParameter.cs
- sqlser.cs
- DropSource.cs
- InputScopeConverter.cs
- DictionaryManager.cs
- ApplicationInterop.cs
- ExceptionDetail.cs
- UniformGrid.cs
- SqlCachedBuffer.cs
- TransformerInfo.cs
- SizeChangedInfo.cs
- SplitterDesigner.cs
- GetWinFXPath.cs
- WebInvokeAttribute.cs
- StorageBasedPackageProperties.cs
- MenuItem.cs
- EventlogProvider.cs
- SymDocumentType.cs
- SQLInt16.cs
- EntityPropertyMappingAttribute.cs
- EntityModelBuildProvider.cs
- FontStyles.cs
- StylusPoint.cs
- StorageMappingItemLoader.cs
- HitTestWithPointDrawingContextWalker.cs
- XamlTypeMapper.cs
- MenuItemStyleCollection.cs
- SourceFileInfo.cs
- IsolatedStorageFileStream.cs
- InfocardInteractiveChannelInitializer.cs
- DataService.cs
- DataGridViewRowsRemovedEventArgs.cs
- ToolStripTextBox.cs
- BindingContext.cs
- RowToFieldTransformer.cs