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
- SafeSecurityHandles.cs
- XslAst.cs
- XmlCDATASection.cs
- ThreadExceptionEvent.cs
- DataBoundControl.cs
- MaskInputRejectedEventArgs.cs
- TextSelectionHighlightLayer.cs
- HttpProfileBase.cs
- ProviderBase.cs
- CalendarDay.cs
- NaturalLanguageHyphenator.cs
- XmlQueryCardinality.cs
- AtomMaterializer.cs
- SystemWebExtensionsSectionGroup.cs
- CommentAction.cs
- UseAttributeSetsAction.cs
- DbSourceParameterCollection.cs
- HtmlInputPassword.cs
- XsltArgumentList.cs
- Pair.cs
- WinCategoryAttribute.cs
- DataGridCell.cs
- StackBuilderSink.cs
- MonitoringDescriptionAttribute.cs
- PartitionResolver.cs
- DataGridTextBoxColumn.cs
- DefaultParameterValueAttribute.cs
- StatusBarDrawItemEvent.cs
- SafeUserTokenHandle.cs
- SessionStateContainer.cs
- ClientRuntimeConfig.cs
- DateTimeFormatInfoScanner.cs
- GuidConverter.cs
- BitmapData.cs
- NetNamedPipeSecurity.cs
- HtmlContainerControl.cs
- CqlQuery.cs
- TextRangeSerialization.cs
- RegistryKey.cs
- RoleManagerModule.cs
- MDIWindowDialog.cs
- Normalization.cs
- DesignerActionGlyph.cs
- FromRequest.cs
- TypedTableGenerator.cs
- FormViewPagerRow.cs
- mda.cs
- MonthCalendar.cs
- FixedFlowMap.cs
- ActivityWithResultValueSerializer.cs
- MetadataElement.cs
- TextDpi.cs
- BreakSafeBase.cs
- Frame.cs
- ErrorFormatter.cs
- HttpRequest.cs
- PartialCachingControl.cs
- XamlReaderHelper.cs
- DbConnectionFactory.cs
- WpfKnownType.cs
- ParsedAttributeCollection.cs
- AvTraceFormat.cs
- UnmanagedMemoryStreamWrapper.cs
- KeyValueInternalCollection.cs
- NonBatchDirectoryCompiler.cs
- XslException.cs
- LassoHelper.cs
- URLIdentityPermission.cs
- HtmlTitle.cs
- ImageDrawing.cs
- CompileXomlTask.cs
- DeviceFilterEditorDialog.cs
- EtwProvider.cs
- AsymmetricKeyExchangeDeformatter.cs
- FacetValueContainer.cs
- FormattedText.cs
- BindingContext.cs
- TextAnchor.cs
- AccessDataSource.cs
- CodeDirectoryCompiler.cs
- FtpRequestCacheValidator.cs
- BroadcastEventHelper.cs
- ActivityCodeDomSerializationManager.cs
- ValuePatternIdentifiers.cs
- Cursors.cs
- ObjectAnimationUsingKeyFrames.cs
- RepeatInfo.cs
- ColumnPropertiesGroup.cs
- TableLayoutStyleCollection.cs
- LockRecoveryTask.cs
- ConfigDefinitionUpdates.cs
- SystemDiagnosticsSection.cs
- PolyBezierSegmentFigureLogic.cs
- CodeDirectoryCompiler.cs
- NativeMethods.cs
- RenderingEventArgs.cs
- GridItemPattern.cs
- AssemblyHelper.cs
- SimpleTypeResolver.cs
- VectorValueSerializer.cs