Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- ObjectDataSourceStatusEventArgs.cs
- XhtmlBasicTextBoxAdapter.cs
- Constraint.cs
- ModuleBuilder.cs
- Logging.cs
- WorkItem.cs
- PageHandlerFactory.cs
- XmlSchemaValidationException.cs
- MarshalDirectiveException.cs
- ClientRolePrincipal.cs
- DataKey.cs
- DesignTimeParseData.cs
- SapiRecognizer.cs
- DocumentSchemaValidator.cs
- BaseValidatorDesigner.cs
- ProfilePropertyMetadata.cs
- WindowVisualStateTracker.cs
- ResourceAttributes.cs
- CodeAttributeDeclarationCollection.cs
- MasterPageBuildProvider.cs
- Version.cs
- BamlBinaryWriter.cs
- MetafileHeaderEmf.cs
- AQNBuilder.cs
- documentsequencetextpointer.cs
- SecurityManager.cs
- UnaryNode.cs
- IsolatedStorage.cs
- CookielessHelper.cs
- WrappedKeySecurityTokenParameters.cs
- AttachedPropertyMethodSelector.cs
- COM2ICategorizePropertiesHandler.cs
- ContentIterators.cs
- TextProperties.cs
- DbXmlEnabledProviderManifest.cs
- DispatcherExceptionEventArgs.cs
- StringDictionaryEditor.cs
- XmlAnyElementAttributes.cs
- XsltSettings.cs
- DesignerActionUIStateChangeEventArgs.cs
- SingleConverter.cs
- counter.cs
- IsolatedStorageFilePermission.cs
- SocketCache.cs
- PlanCompilerUtil.cs
- KeyGestureValueSerializer.cs
- FreezableOperations.cs
- DataSourceView.cs
- DataDocumentXPathNavigator.cs
- ConfigurationStrings.cs
- ObjectToken.cs
- SubqueryTrackingVisitor.cs
- ECDiffieHellman.cs
- TraceSection.cs
- CompatibleComparer.cs
- RSAProtectedConfigurationProvider.cs
- InstanceKeyView.cs
- DrawTreeNodeEventArgs.cs
- ReflectionTypeLoadException.cs
- CodeAccessSecurityEngine.cs
- SurrogateDataContract.cs
- ConditionChanges.cs
- DuplexChannelFactory.cs
- XD.cs
- SettingsProperty.cs
- EntityDataSourceSelectedEventArgs.cs
- ContractCodeDomInfo.cs
- XmlSchemaValidator.cs
- XmlMembersMapping.cs
- SafeProcessHandle.cs
- RectConverter.cs
- VisualTransition.cs
- RelationshipWrapper.cs
- WebPartDisplayModeEventArgs.cs
- SiteMapNodeItemEventArgs.cs
- __Error.cs
- ToolStripPanel.cs
- HorizontalAlignConverter.cs
- DynamicValidatorEventArgs.cs
- NameValuePermission.cs
- Attribute.cs
- DynamicFilter.cs
- SettingsProviderCollection.cs
- ClusterSafeNativeMethods.cs
- MetadataPropertyvalue.cs
- PermissionListSet.cs
- UserNamePasswordValidator.cs
- DesignerCapabilities.cs
- MultilineStringConverter.cs
- FrameworkReadOnlyPropertyMetadata.cs
- Control.cs
- UserPersonalizationStateInfo.cs
- DynamicDocumentPaginator.cs
- AuthenticationModulesSection.cs
- FrameworkElementAutomationPeer.cs
- GradientStopCollection.cs
- Operator.cs
- Rect3DValueSerializer.cs
- SessionSwitchEventArgs.cs
- FormViewRow.cs