Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Objects / Internal / EntityWithKeyStrategy.cs / 1305376 / EntityWithKeyStrategy.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Objects.DataClasses;
using System.Diagnostics;
namespace System.Data.Objects.Internal
{
///
/// Implementor of IEntityKeyStrategy for entities that implement IEntityWithKey. Getting and setting
/// the key is deferred to the entity itself.
///
internal sealed class EntityWithKeyStrategy : IEntityKeyStrategy
{
private IEntityWithKey _entity;
///
/// Creates a strategy object for the given entity. Keys will be stored in the entity.
///
/// The entity to use
public EntityWithKeyStrategy(IEntityWithKey entity)
{
_entity = entity;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKey()
{
return _entity.EntityKey;
}
// See IEntityKeyStrategy
public void SetEntityKey(EntityKey key)
{
_entity.EntityKey = key;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKeyFromEntity()
{
return _entity.EntityKey;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Objects.DataClasses;
using System.Diagnostics;
namespace System.Data.Objects.Internal
{
///
/// Implementor of IEntityKeyStrategy for entities that implement IEntityWithKey. Getting and setting
/// the key is deferred to the entity itself.
///
internal sealed class EntityWithKeyStrategy : IEntityKeyStrategy
{
private IEntityWithKey _entity;
///
/// Creates a strategy object for the given entity. Keys will be stored in the entity.
///
/// The entity to use
public EntityWithKeyStrategy(IEntityWithKey entity)
{
_entity = entity;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKey()
{
return _entity.EntityKey;
}
// See IEntityKeyStrategy
public void SetEntityKey(EntityKey key)
{
_entity.EntityKey = key;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKeyFromEntity()
{
return _entity.EntityKey;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlNodeList.cs
- UserPreferenceChangedEventArgs.cs
- TextBoxRenderer.cs
- ValidationRuleCollection.cs
- CellIdBoolean.cs
- CapabilitiesPattern.cs
- XmlSerializationGeneratedCode.cs
- DataBoundControlHelper.cs
- StructuralType.cs
- SizeConverter.cs
- EventLogPermissionEntry.cs
- DBBindings.cs
- HtmlControl.cs
- ObjectDataSourceMethodEventArgs.cs
- CqlErrorHelper.cs
- HtmlHistory.cs
- ExpressionWriter.cs
- InputProcessorProfiles.cs
- EventDescriptorCollection.cs
- _NtlmClient.cs
- CutCopyPasteHelper.cs
- PrimarySelectionGlyph.cs
- ToolStripItem.cs
- ThicknessKeyFrameCollection.cs
- DataFormat.cs
- DoubleLinkListEnumerator.cs
- HttpApplicationFactory.cs
- IndexedGlyphRun.cs
- ContainsSearchOperator.cs
- NativeMethods.cs
- OleDbParameterCollection.cs
- WebBrowserDocumentCompletedEventHandler.cs
- SqlClientWrapperSmiStream.cs
- Padding.cs
- ListViewDataItem.cs
- ClientSettingsProvider.cs
- XPathBuilder.cs
- UnsafeNativeMethodsPenimc.cs
- NetworkInformationPermission.cs
- UIAgentMonitor.cs
- WaveHeader.cs
- QueryNode.cs
- WebBrowserEvent.cs
- XmlSchemaComplexType.cs
- ExchangeUtilities.cs
- LiteralTextContainerControlBuilder.cs
- CorrelationActionMessageFilter.cs
- XmlSchemaObjectTable.cs
- TextModifierScope.cs
- TimestampInformation.cs
- Visual3D.cs
- ToolStripControlHost.cs
- XXXOnTypeBuilderInstantiation.cs
- BatchServiceHost.cs
- DropDownList.cs
- UpDownEvent.cs
- InfoCardRSACryptoProvider.cs
- OleAutBinder.cs
- SafeArrayRankMismatchException.cs
- WorkflowViewElement.cs
- DependencyObjectType.cs
- ISO2022Encoding.cs
- XmlEnumAttribute.cs
- counter.cs
- RoutedEventHandlerInfo.cs
- FlowPanelDesigner.cs
- followingquery.cs
- ExternalException.cs
- PresentationSource.cs
- Span.cs
- PersistenceTypeAttribute.cs
- CompilationLock.cs
- NonSerializedAttribute.cs
- WindowsPrincipal.cs
- RegexCaptureCollection.cs
- BasicHttpMessageSecurity.cs
- SymmetricAlgorithm.cs
- QueryHandler.cs
- Oid.cs
- ResourceWriter.cs
- MethodExpr.cs
- OdbcConnectionHandle.cs
- InputLangChangeRequestEvent.cs
- Transform3DCollection.cs
- SatelliteContractVersionAttribute.cs
- PersonalizationProvider.cs
- StdRegProviderWrapper.cs
- PowerStatus.cs
- ServicePointManagerElement.cs
- DbDataAdapter.cs
- PieceNameHelper.cs
- Bidi.cs
- TemplateBuilder.cs
- TraceEventCache.cs
- LocatorBase.cs
- ScrollItemPatternIdentifiers.cs
- BehaviorService.cs
- MessageHeaderT.cs
- ConfigurationCollectionAttribute.cs
- UnsafeNetInfoNativeMethods.cs