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
- ObjectQuery_EntitySqlExtensions.cs
- xsdvalidator.cs
- NamespaceList.cs
- GetPageCompletedEventArgs.cs
- ModuleConfigurationInfo.cs
- UserControlParser.cs
- DataGridViewAccessibleObject.cs
- CustomLineCap.cs
- TraceListeners.cs
- AvTrace.cs
- EasingFunctionBase.cs
- ClientUtils.cs
- MouseButton.cs
- DateTimePickerDesigner.cs
- ProcessHostFactoryHelper.cs
- Invariant.cs
- FontNameEditor.cs
- FontNamesConverter.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- ComponentCollection.cs
- WorkflowDesignerColors.cs
- HttpChannelBindingToken.cs
- SrgsRuleRef.cs
- Repeater.cs
- VirtualPath.cs
- EntityConnection.cs
- OneOfElement.cs
- StatusBar.cs
- PrincipalPermission.cs
- WindowsToolbar.cs
- Documentation.cs
- ClientTargetSection.cs
- MatrixKeyFrameCollection.cs
- XmlSerializableReader.cs
- ReflectionHelper.cs
- TCEAdapterGenerator.cs
- Privilege.cs
- Size.cs
- SiteMapNodeItemEventArgs.cs
- DataQuery.cs
- XmlSchemaValidator.cs
- Package.cs
- querybuilder.cs
- AQNBuilder.cs
- SimpleBitVector32.cs
- AppModelKnownContentFactory.cs
- CodeDirectionExpression.cs
- DesigntimeLicenseContext.cs
- TextTreeInsertElementUndoUnit.cs
- DeviceContext.cs
- CodeExpressionStatement.cs
- XmlSortKeyAccumulator.cs
- Int64AnimationBase.cs
- TextEditorCharacters.cs
- LinqDataSourceView.cs
- figurelength.cs
- InternalMappingException.cs
- Tuple.cs
- SelfIssuedTokenFactoryCredential.cs
- FileBasedResourceGroveler.cs
- DynamicAttribute.cs
- CodeGeneratorAttribute.cs
- ConsoleTraceListener.cs
- HandoffBehavior.cs
- ResourceReferenceKeyNotFoundException.cs
- TextServicesProperty.cs
- WebBrowserContainer.cs
- SponsorHelper.cs
- ReflectPropertyDescriptor.cs
- AppDomainUnloadedException.cs
- XPathDocumentIterator.cs
- CallbackValidatorAttribute.cs
- WebDisplayNameAttribute.cs
- Quaternion.cs
- EventsTab.cs
- ListViewDeleteEventArgs.cs
- Translator.cs
- ControlPersister.cs
- SqlDataSourceView.cs
- LayoutEngine.cs
- SimpleTypeResolver.cs
- HitTestResult.cs
- TableHeaderCell.cs
- OdbcConnectionOpen.cs
- PagesSection.cs
- SwitchElementsCollection.cs
- ViewGenerator.cs
- ControlBindingsCollection.cs
- ToolboxComponentsCreatedEventArgs.cs
- CustomWebEventKey.cs
- NullableBoolConverter.cs
- MenuItem.cs
- SubqueryRules.cs
- RoutingService.cs
- XmlBinaryReader.cs
- ListBoxChrome.cs
- Slider.cs
- DataGrid.cs
- HttpListenerElement.cs
- TextDecoration.cs