Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Objects / ObjectStateEntryDbUpdatableDataRecord.cs / 1 / 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(ObjectStateEntry 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: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } internal ObjectStateEntryDbUpdatableDataRecord(ObjectStateEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); Debug.Assert(cacheEntry.IsRelationship, "Wrong ctor is called for entity"); 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: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return _cacheEntry.GetCurrentRelationValue(ordinal); } else { return _cacheEntry.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.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(ObjectStateEntry 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: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } internal ObjectStateEntryDbUpdatableDataRecord(ObjectStateEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); Debug.Assert(cacheEntry.IsRelationship, "Wrong ctor is called for entity"); 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: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return _cacheEntry.GetCurrentRelationValue(ordinal); } else { return _cacheEntry.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.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
- ArrayList.cs
- EnumConverter.cs
- graph.cs
- QueryPageSettingsEventArgs.cs
- DecoderReplacementFallback.cs
- HttpHandlerActionCollection.cs
- FormViewDeletedEventArgs.cs
- MsmqTransportReceiveParameters.cs
- TcpClientSocketManager.cs
- DynamicRenderer.cs
- WindowsScrollBarBits.cs
- WeakReference.cs
- Keyboard.cs
- EntityDataSourceWrapper.cs
- ListViewItemMouseHoverEvent.cs
- Binding.cs
- TabRenderer.cs
- SoapSchemaImporter.cs
- WebPartsPersonalization.cs
- CrossContextChannel.cs
- CapabilitiesAssignment.cs
- TickBar.cs
- TraceSource.cs
- StaticTextPointer.cs
- ClientTargetSection.cs
- HiddenFieldPageStatePersister.cs
- ContextMenuStripActionList.cs
- SamlAttributeStatement.cs
- MailBnfHelper.cs
- GridViewUpdateEventArgs.cs
- EntityProviderFactory.cs
- PolyLineSegmentFigureLogic.cs
- Identifier.cs
- ToolStripArrowRenderEventArgs.cs
- SafeNativeMethods.cs
- WebRequestModuleElement.cs
- UrlPropertyAttribute.cs
- JsonByteArrayDataContract.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- EntityWrapper.cs
- XmlSerializationGeneratedCode.cs
- AnimationStorage.cs
- MruCache.cs
- Compensate.cs
- QuaternionAnimation.cs
- SessionSwitchEventArgs.cs
- ManagementScope.cs
- DivideByZeroException.cs
- GridProviderWrapper.cs
- WebScriptEnablingElement.cs
- GregorianCalendar.cs
- GeneralTransform3DTo2DTo3D.cs
- PropertyPath.cs
- HandlerMappingMemo.cs
- TakeOrSkipQueryOperator.cs
- ControlCachePolicy.cs
- Point3DAnimation.cs
- WebConfigurationManager.cs
- Soap11ServerProtocol.cs
- StandardOleMarshalObject.cs
- SHA256.cs
- FileLevelControlBuilderAttribute.cs
- _NegoState.cs
- SRGSCompiler.cs
- TypeToken.cs
- EntityDataSourceViewSchema.cs
- LayoutTableCell.cs
- AssemblyBuilder.cs
- Mouse.cs
- AnnotationObservableCollection.cs
- PartEditor.cs
- ProxyHwnd.cs
- RemoveStoryboard.cs
- _ProxyRegBlob.cs
- SynchronousChannel.cs
- HttpCacheParams.cs
- CachedBitmap.cs
- DoubleCollection.cs
- CheckBoxList.cs
- DesigntimeLicenseContext.cs
- ImpersonateTokenRef.cs
- CollectionViewGroupInternal.cs
- MaterialGroup.cs
- WebProxyScriptElement.cs
- GcHandle.cs
- DataBoundLiteralControl.cs
- XmlSchemaSet.cs
- DataGridViewLinkColumn.cs
- TypeConverterHelper.cs
- PeerToPeerException.cs
- ViewStateException.cs
- UseLicense.cs
- EventTrigger.cs
- ComponentManagerBroker.cs
- KeyEventArgs.cs
- SafeRightsManagementPubHandle.cs
- ChtmlLinkAdapter.cs
- Tuple.cs
- RowParagraph.cs
- Border.cs