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
- ParentUndoUnit.cs
- CompilerScope.Storage.cs
- XmlReaderSettings.cs
- Baml2006ReaderContext.cs
- hresults.cs
- ArrangedElement.cs
- PhysicalFontFamily.cs
- ContentWrapperAttribute.cs
- CompositionAdorner.cs
- SafeNativeMethodsOther.cs
- CopyCodeAction.cs
- PenContexts.cs
- Vertex.cs
- Rfc2898DeriveBytes.cs
- cookiecontainer.cs
- DataGridViewRowCancelEventArgs.cs
- SafeRightsManagementEnvironmentHandle.cs
- CryptoStream.cs
- CaseInsensitiveComparer.cs
- SocketElement.cs
- bindurihelper.cs
- NotifyParentPropertyAttribute.cs
- ReferenceEqualityComparer.cs
- NotSupportedException.cs
- ProfessionalColors.cs
- SchemaExporter.cs
- SqlError.cs
- DataProtection.cs
- WebRequestModuleElementCollection.cs
- LayoutEditorPart.cs
- Floater.cs
- WriteTimeStream.cs
- FamilyCollection.cs
- ManipulationLogic.cs
- SafeHandles.cs
- TextEditorLists.cs
- ListMarkerLine.cs
- Attributes.cs
- ManipulationVelocities.cs
- DataFormats.cs
- WindowsSlider.cs
- StringUtil.cs
- CodeTypeMember.cs
- SafeFileMapViewHandle.cs
- Token.cs
- TypeUtil.cs
- ConstructorBuilder.cs
- RangeValidator.cs
- XmlArrayItemAttributes.cs
- CannotUnloadAppDomainException.cs
- HtmlInputButton.cs
- XPathAncestorQuery.cs
- SubqueryTrackingVisitor.cs
- XmlUtf8RawTextWriter.cs
- SecuritySessionSecurityTokenProvider.cs
- TrackingDataItem.cs
- ObjectSet.cs
- CatalogPart.cs
- X509SecurityToken.cs
- InvalidCastException.cs
- PackageProperties.cs
- SmiMetaDataProperty.cs
- MatrixAnimationBase.cs
- HashMembershipCondition.cs
- ItemChangedEventArgs.cs
- CellIdBoolean.cs
- DisplayMemberTemplateSelector.cs
- Normalizer.cs
- UInt64Converter.cs
- GroupBoxRenderer.cs
- ManagementDateTime.cs
- BaseDataList.cs
- Matrix.cs
- ReceiveParametersContent.cs
- ToolStripButton.cs
- CompilerHelpers.cs
- PartialToken.cs
- WinFormsSecurity.cs
- ProcessHostConfigUtils.cs
- CharEntityEncoderFallback.cs
- BitmapSizeOptions.cs
- EntityParameter.cs
- ServiceXNameTypeConverter.cs
- MILUtilities.cs
- IconHelper.cs
- Receive.cs
- InkCanvasFeedbackAdorner.cs
- FrameworkContentElement.cs
- RegisteredDisposeScript.cs
- ObjectContext.cs
- TextTreeDeleteContentUndoUnit.cs
- IisTraceWebEventProvider.cs
- ContainerSelectorGlyph.cs
- SafeFindHandle.cs
- WindowsScrollBarBits.cs
- Tag.cs
- EmptyControlCollection.cs
- TypeBuilder.cs
- CompressStream.cs
- WindowsSolidBrush.cs