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
- QueryRelOp.cs
- MultiAsyncResult.cs
- ErrorWrapper.cs
- XmlResolver.cs
- SQLUtility.cs
- HideDisabledControlAdapter.cs
- CommonObjectSecurity.cs
- ExternalException.cs
- DynamicDataRoute.cs
- KeyValuePair.cs
- WebZone.cs
- WsatEtwTraceListener.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- TypeSystemHelpers.cs
- TraceSwitch.cs
- DecoderNLS.cs
- RenderData.cs
- ArrayWithOffset.cs
- MediaPlayer.cs
- DataGridViewRowStateChangedEventArgs.cs
- ToolStripItem.cs
- PermissionListSet.cs
- CreateUserWizardAutoFormat.cs
- DynamicQueryStringParameter.cs
- TaskScheduler.cs
- CompilerCollection.cs
- TemplateBuilder.cs
- DesignerTransaction.cs
- SafeSerializationManager.cs
- DefaultWorkflowLoaderService.cs
- HttpProcessUtility.cs
- WebPartsPersonalization.cs
- SaveFileDialog.cs
- PropVariant.cs
- DictionaryBase.cs
- ResourceReferenceExpression.cs
- BindingOperations.cs
- Query.cs
- EdmProperty.cs
- AssemblyEvidenceFactory.cs
- ItemDragEvent.cs
- WebPartHelpVerb.cs
- DataListGeneralPage.cs
- ArraySegment.cs
- HashStream.cs
- IndexedGlyphRun.cs
- IdentifierElement.cs
- UnitySerializationHolder.cs
- MailSettingsSection.cs
- PrinterSettings.cs
- AsymmetricSignatureDeformatter.cs
- IisTraceWebEventProvider.cs
- PropertyValueChangedEvent.cs
- DockAndAnchorLayout.cs
- FixedSOMTableRow.cs
- safePerfProviderHandle.cs
- CompositeKey.cs
- HttpConfigurationSystem.cs
- UndoManager.cs
- DataControlPagerLinkButton.cs
- ExpressionVisitor.cs
- EnterpriseServicesHelper.cs
- ConversionContext.cs
- SqlFunctionAttribute.cs
- SerializationEventsCache.cs
- MD5.cs
- StyleXamlParser.cs
- KnownTypes.cs
- FrameAutomationPeer.cs
- AliasedSlot.cs
- URLAttribute.cs
- ListView.cs
- _NTAuthentication.cs
- CompiledRegexRunnerFactory.cs
- WebPartHelpVerb.cs
- SchemaImporterExtensionElementCollection.cs
- CodeIdentifiers.cs
- ContentHostHelper.cs
- WhitespaceRule.cs
- DefaultEventAttribute.cs
- SystemIcmpV6Statistics.cs
- EdmProperty.cs
- DataSetMappper.cs
- FilterableAttribute.cs
- AppModelKnownContentFactory.cs
- MultiPageTextView.cs
- XNodeValidator.cs
- ExpressionsCollectionConverter.cs
- AxDesigner.cs
- SoapDocumentServiceAttribute.cs
- TemplateManager.cs
- AssociationEndMember.cs
- PointConverter.cs
- ProviderConnectionPoint.cs
- Point3DValueSerializer.cs
- AttributeEmitter.cs
- DATA_BLOB.cs
- AdjustableArrowCap.cs
- ErrorWrapper.cs
- CompilerGlobalScopeAttribute.cs