Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / WebControls / Expressions / DataSourceExpression.cs / 1305376 / DataSourceExpression.cs
#if ORYX_VNEXT namespace Microsoft.Web.Data.UI.WebControls.Expressions { #else namespace System.Web.UI.WebControls.Expressions { #endif using System; using System.ComponentModel; using System.Linq; using System.Linq.Expressions; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public abstract class DataSourceExpression : IStateManager { private bool _tracking; private StateBag _viewState; protected HttpContext Context { get; private set; } protected Control Owner { get; private set; } public IQueryableDataSource DataSource { get; // Internal set for unit testing internal set; } protected bool IsTrackingViewState { get { return _tracking; } } [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), ] protected StateBag ViewState { get { if (_viewState == null) { _viewState = new StateBag(); if (_tracking) ((IStateManager)_viewState).TrackViewState(); } return _viewState; } } protected DataSourceExpression() { } // internal for unit testing internal DataSourceExpression(Control owner) { Owner = owner; } public void SetDirty() { ViewState.SetDirty(true); } protected virtual void LoadViewState(object savedState) { if (savedState != null) { ((IStateManager)ViewState).LoadViewState(savedState); } } protected virtual object SaveViewState() { return (_viewState != null) ? ((IStateManager)_viewState).SaveViewState() : null; } protected virtual void TrackViewState() { _tracking = true; if (_viewState != null) { ((IStateManager)_viewState).TrackViewState(); } } public abstract IQueryable GetQueryable(IQueryable source); public virtual void SetContext(Control owner, HttpContext context, IQueryableDataSource dataSource) { if (owner == null) { throw new ArgumentNullException("owner"); } if (context == null) { throw new ArgumentNullException("context"); } if (dataSource == null) { throw new ArgumentNullException("dataSource"); } Owner = owner; Context = context; DataSource = dataSource; } #region IStateManager Members bool IStateManager.IsTrackingViewState { get { return IsTrackingViewState; } } void IStateManager.LoadViewState(object state) { LoadViewState(state); } object IStateManager.SaveViewState() { return SaveViewState(); } void IStateManager.TrackViewState() { TrackViewState(); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. #if ORYX_VNEXT namespace Microsoft.Web.Data.UI.WebControls.Expressions { #else namespace System.Web.UI.WebControls.Expressions { #endif using System; using System.ComponentModel; using System.Linq; using System.Linq.Expressions; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public abstract class DataSourceExpression : IStateManager { private bool _tracking; private StateBag _viewState; protected HttpContext Context { get; private set; } protected Control Owner { get; private set; } public IQueryableDataSource DataSource { get; // Internal set for unit testing internal set; } protected bool IsTrackingViewState { get { return _tracking; } } [ Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), ] protected StateBag ViewState { get { if (_viewState == null) { _viewState = new StateBag(); if (_tracking) ((IStateManager)_viewState).TrackViewState(); } return _viewState; } } protected DataSourceExpression() { } // internal for unit testing internal DataSourceExpression(Control owner) { Owner = owner; } public void SetDirty() { ViewState.SetDirty(true); } protected virtual void LoadViewState(object savedState) { if (savedState != null) { ((IStateManager)ViewState).LoadViewState(savedState); } } protected virtual object SaveViewState() { return (_viewState != null) ? ((IStateManager)_viewState).SaveViewState() : null; } protected virtual void TrackViewState() { _tracking = true; if (_viewState != null) { ((IStateManager)_viewState).TrackViewState(); } } public abstract IQueryable GetQueryable(IQueryable source); public virtual void SetContext(Control owner, HttpContext context, IQueryableDataSource dataSource) { if (owner == null) { throw new ArgumentNullException("owner"); } if (context == null) { throw new ArgumentNullException("context"); } if (dataSource == null) { throw new ArgumentNullException("dataSource"); } Owner = owner; Context = context; DataSource = dataSource; } #region IStateManager Members bool IStateManager.IsTrackingViewState { get { return IsTrackingViewState; } } void IStateManager.LoadViewState(object state) { LoadViewState(state); } object IStateManager.SaveViewState() { return SaveViewState(); } void IStateManager.TrackViewState() { TrackViewState(); } #endregion } } // 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
- TemplateBamlRecordReader.cs
- ValidatorUtils.cs
- ApplyImportsAction.cs
- xsdvalidator.cs
- ConnectionPoint.cs
- IPipelineRuntime.cs
- AsyncResult.cs
- RegexReplacement.cs
- wmiprovider.cs
- UserControlAutomationPeer.cs
- HandlerFactoryWrapper.cs
- DragDeltaEventArgs.cs
- InlinedAggregationOperator.cs
- InkPresenter.cs
- ClrPerspective.cs
- SchemaElement.cs
- SourceItem.cs
- WebEvents.cs
- COM2ExtendedUITypeEditor.cs
- WsatConfiguration.cs
- ChangeBlockUndoRecord.cs
- ReflectionServiceProvider.cs
- ClickablePoint.cs
- AccessText.cs
- XmlSchemaInferenceException.cs
- BaseDataListActionList.cs
- DataGridViewControlCollection.cs
- ListControlDesigner.cs
- _NegoStream.cs
- CompModSwitches.cs
- ComboBoxRenderer.cs
- Positioning.cs
- ProcessHostMapPath.cs
- Graph.cs
- GeometryCombineModeValidation.cs
- Int64AnimationBase.cs
- GradientSpreadMethodValidation.cs
- ReadonlyMessageFilter.cs
- SqlBooleanMismatchVisitor.cs
- UnionExpr.cs
- RIPEMD160Managed.cs
- SimpleHandlerBuildProvider.cs
- SrgsNameValueTag.cs
- ProviderConnectionPointCollection.cs
- ValueConversionAttribute.cs
- XmlBinaryReader.cs
- EditorPartChrome.cs
- TextWriterTraceListener.cs
- PointAnimation.cs
- CompiledRegexRunner.cs
- GregorianCalendar.cs
- propertytag.cs
- StyleCollection.cs
- StorageInfo.cs
- HMACSHA256.cs
- XappLauncher.cs
- AddInActivator.cs
- ApplicationSettingsBase.cs
- WebFaultClientMessageInspector.cs
- ProxyWebPart.cs
- tibetanshape.cs
- TextUtf8RawTextWriter.cs
- QueryCacheKey.cs
- HelloOperation11AsyncResult.cs
- StorageRoot.cs
- HttpWebResponse.cs
- VectorConverter.cs
- XmlSchemaComplexType.cs
- ChildChangedEventArgs.cs
- ToolboxItemLoader.cs
- RequestSecurityTokenResponse.cs
- DataGridViewColumnCollection.cs
- ReflectEventDescriptor.cs
- IndexOutOfRangeException.cs
- FileClassifier.cs
- ComponentResourceKeyConverter.cs
- CachedRequestParams.cs
- HandlerBase.cs
- Matrix.cs
- PropertyDescriptor.cs
- Vector3DConverter.cs
- Quaternion.cs
- DataGridViewRow.cs
- WebPartConnectionsDisconnectVerb.cs
- Window.cs
- Privilege.cs
- TabletDeviceInfo.cs
- ErrorFormatterPage.cs
- HtmlTitle.cs
- SubqueryRules.cs
- FileRecordSequenceHelper.cs
- DesignerAttribute.cs
- ParameterInfo.cs
- AssemblyResourceLoader.cs
- TagPrefixAttribute.cs
- _ListenerAsyncResult.cs
- TraceEventCache.cs
- TreeNodeSelectionProcessor.cs
- JsonWriter.cs
- PagesChangedEventArgs.cs