Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Objects / ObjectStateEntryDbUpdatableDataRecord.cs / 2 / 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
- MemoryRecordBuffer.cs
- PropertyDescriptorCollection.cs
- FixedNode.cs
- GiveFeedbackEventArgs.cs
- SerialStream.cs
- StyleHelper.cs
- PartBasedPackageProperties.cs
- StringExpressionSet.cs
- PreservationFileWriter.cs
- ImageFormat.cs
- FixedSOMPage.cs
- PageCache.cs
- LogicalExpr.cs
- SamlAuthorizationDecisionStatement.cs
- TargetControlTypeAttribute.cs
- EditorOptionAttribute.cs
- OracleString.cs
- XmlObjectSerializerReadContextComplexJson.cs
- MD5CryptoServiceProvider.cs
- TextHidden.cs
- TransactionException.cs
- EraserBehavior.cs
- _NegotiateClient.cs
- TraceData.cs
- OracleDateTime.cs
- ResourceAssociationSetEnd.cs
- System.Data.OracleClient_BID.cs
- ChtmlTextBoxAdapter.cs
- ByteViewer.cs
- FieldDescriptor.cs
- GreenMethods.cs
- MediaContextNotificationWindow.cs
- ChangeProcessor.cs
- WebBrowserBase.cs
- TextTreeRootTextBlock.cs
- XamlParser.cs
- NavigationPropertySingletonExpression.cs
- DataGrid.cs
- FacetEnabledSchemaElement.cs
- WebAdminConfigurationHelper.cs
- BindingContext.cs
- DataGridState.cs
- DCSafeHandle.cs
- CompoundFileStorageReference.cs
- BoundingRectTracker.cs
- GridItemPattern.cs
- NoResizeSelectionBorderGlyph.cs
- ChameleonKey.cs
- GradientStopCollection.cs
- DispatcherFrame.cs
- StringConverter.cs
- HttpListenerElement.cs
- UnsafeNativeMethodsTablet.cs
- ListParagraph.cs
- Renderer.cs
- DataAccessor.cs
- XmlSchemaInfo.cs
- Track.cs
- DataColumnMapping.cs
- BatchParser.cs
- PageThemeBuildProvider.cs
- BitmapEffectInput.cs
- EntityDataSourceContextCreatedEventArgs.cs
- ExpressionVisitorHelpers.cs
- IItemContainerGenerator.cs
- CornerRadiusConverter.cs
- BuildResultCache.cs
- ProgressBarAutomationPeer.cs
- EventLogPermission.cs
- AsyncOperationManager.cs
- ControlValuePropertyAttribute.cs
- AssemblyBuilderData.cs
- DefaultValueAttribute.cs
- CaseStatementSlot.cs
- HtmlMeta.cs
- WebBrowsableAttribute.cs
- DataGridTable.cs
- InputScope.cs
- RequestSecurityTokenResponseCollection.cs
- SendActivityDesignerTheme.cs
- TablePatternIdentifiers.cs
- XsltLoader.cs
- GPRECT.cs
- ThreadStartException.cs
- MenuCommands.cs
- SystemIPv4InterfaceProperties.cs
- FontCacheUtil.cs
- AnonymousIdentificationSection.cs
- WinOEToolBoxItem.cs
- HttpFileCollectionWrapper.cs
- CodeCompiler.cs
- ReflectionPermission.cs
- SchemaMerger.cs
- OdbcInfoMessageEvent.cs
- Label.cs
- ResetableIterator.cs
- TcpTransportSecurityElement.cs
- PolyBezierSegment.cs
- ListenerElementsCollection.cs
- OdbcParameterCollection.cs