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
- ButtonBase.cs
- BeginStoryboard.cs
- MatrixKeyFrameCollection.cs
- ManifestBasedResourceGroveler.cs
- DesignerWebPartChrome.cs
- SoapParser.cs
- RemotingConfigParser.cs
- BitmapMetadata.cs
- SqlDataSourceCustomCommandEditor.cs
- CanExecuteRoutedEventArgs.cs
- XmlAnyElementAttribute.cs
- TemplateControlCodeDomTreeGenerator.cs
- BinaryConverter.cs
- RelationshipEndCollection.cs
- SchemaElementLookUpTable.cs
- DocumentXPathNavigator.cs
- NetMsmqBindingElement.cs
- UInt64Converter.cs
- FigureParaClient.cs
- Hyperlink.cs
- Size3DConverter.cs
- MembershipUser.cs
- Vector.cs
- UniqueIdentifierService.cs
- SafeNativeMethods.cs
- ConfigurationSectionCollection.cs
- TokenizerHelper.cs
- ToolStripTextBox.cs
- ItemTypeToolStripMenuItem.cs
- ContractAdapter.cs
- TemplateControlBuildProvider.cs
- WebHeaderCollection.cs
- FontInfo.cs
- WebResponse.cs
- GatewayIPAddressInformationCollection.cs
- AppDomainEvidenceFactory.cs
- WebPartEditorCancelVerb.cs
- RelationshipSet.cs
- DataFormat.cs
- XmlSchemaObject.cs
- OdbcDataAdapter.cs
- XmlDigitalSignatureProcessor.cs
- MultiSelector.cs
- LineBreak.cs
- RemotingSurrogateSelector.cs
- StaticResourceExtension.cs
- SqlUtils.cs
- NamedPipeAppDomainProtocolHandler.cs
- Vector3dCollection.cs
- SamlDoNotCacheCondition.cs
- StreamFormatter.cs
- SiteMapNodeItem.cs
- JapaneseCalendar.cs
- MailWriter.cs
- X509CertificateCollection.cs
- SchemaEntity.cs
- ItemChangedEventArgs.cs
- DataGridViewAdvancedBorderStyle.cs
- VectorAnimationBase.cs
- OciHandle.cs
- AnyAllSearchOperator.cs
- LinkedResourceCollection.cs
- Match.cs
- UnknownBitmapEncoder.cs
- MobileComponentEditorPage.cs
- AggregateNode.cs
- XmlSchemas.cs
- UpDownEvent.cs
- Encoder.cs
- CrossSiteScriptingValidation.cs
- RightsManagementEncryptionTransform.cs
- RoleManagerEventArgs.cs
- SmtpLoginAuthenticationModule.cs
- UrlAuthFailedErrorFormatter.cs
- FindRequestContext.cs
- Listbox.cs
- DefinitionProperties.cs
- DecoratedNameAttribute.cs
- CodeTypeReferenceExpression.cs
- WebBaseEventKeyComparer.cs
- StringExpressionSet.cs
- EncryptedPackage.cs
- NotSupportedException.cs
- StreamingContext.cs
- XsdDataContractExporter.cs
- ADConnectionHelper.cs
- SmiRecordBuffer.cs
- FixedSOMPageElement.cs
- Figure.cs
- BasePattern.cs
- CollectionTypeElement.cs
- AsymmetricSecurityProtocol.cs
- ParsedAttributeCollection.cs
- RulePatternOps.cs
- SharedUtils.cs
- GridViewCellAutomationPeer.cs
- UntrustedRecipientException.cs
- AutoGeneratedField.cs
- SafeWaitHandle.cs
- DLinqAssociationProvider.cs