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
- BrowserCapabilitiesFactoryBase.cs
- DataGridItem.cs
- TrackingMemoryStream.cs
- SpellerHighlightLayer.cs
- AutoCompleteStringCollection.cs
- TextRangeSerialization.cs
- Activator.cs
- XmlSchemaProviderAttribute.cs
- TableFieldsEditor.cs
- WebPartConnectionsConfigureVerb.cs
- IgnoreDataMemberAttribute.cs
- CommonProperties.cs
- WindowsGraphics.cs
- CompositeDataBoundControl.cs
- NumberSubstitution.cs
- SerializerDescriptor.cs
- InkPresenterAutomationPeer.cs
- Delegate.cs
- InvalidFilterCriteriaException.cs
- PageSetupDialog.cs
- BooleanConverter.cs
- BaseServiceProvider.cs
- RenderDataDrawingContext.cs
- LinqDataSourceDeleteEventArgs.cs
- TextParagraphCache.cs
- WebControl.cs
- WCFServiceClientProxyGenerator.cs
- UserControlFileEditor.cs
- EncodingStreamWrapper.cs
- TemplateBindingExpressionConverter.cs
- X509ScopedServiceCertificateElement.cs
- Aggregates.cs
- TimeStampChecker.cs
- ExceptionValidationRule.cs
- ModifierKeysConverter.cs
- ChtmlLinkAdapter.cs
- ItemAutomationPeer.cs
- Visual.cs
- DefinitionBase.cs
- DataAccessor.cs
- InputElement.cs
- VectorAnimation.cs
- ListViewTableRow.cs
- documentsequencetextcontainer.cs
- DurableServiceAttribute.cs
- ClientSettings.cs
- CallSiteBinder.cs
- CopyNamespacesAction.cs
- XmlIncludeAttribute.cs
- HttpDebugHandler.cs
- Crc32.cs
- ExceptionUtil.cs
- SetterBaseCollection.cs
- GenericEnumerator.cs
- InvalidDataException.cs
- AutomationPattern.cs
- BehaviorEditorPart.cs
- ParserOptions.cs
- ReliableSessionBindingElementImporter.cs
- SQLByteStorage.cs
- WebPartExportVerb.cs
- WebPartConnectionsEventArgs.cs
- DateBoldEvent.cs
- LinearKeyFrames.cs
- ToolStripPanelRow.cs
- AnimatedTypeHelpers.cs
- ClientSession.cs
- HttpCacheVary.cs
- InProcStateClientManager.cs
- EntitySet.cs
- UseLicense.cs
- Pair.cs
- CircleEase.cs
- MasterPageBuildProvider.cs
- Utility.cs
- DataGridViewColumnEventArgs.cs
- Calendar.cs
- CustomError.cs
- PersianCalendar.cs
- Inflater.cs
- xamlnodes.cs
- PointCollectionConverter.cs
- TypedTableBaseExtensions.cs
- SqlCommandBuilder.cs
- FormatConvertedBitmap.cs
- SqlDataReaderSmi.cs
- DataGridViewSelectedCellCollection.cs
- MimeMultiPart.cs
- IsolatedStoragePermission.cs
- _Events.cs
- VScrollProperties.cs
- FileRecordSequence.cs
- BuildTopDownAttribute.cs
- Constraint.cs
- AsyncOperationManager.cs
- CmsUtils.cs
- BitmapEffectvisualstate.cs
- CheckoutException.cs
- Decimal.cs
- Point4DValueSerializer.cs