Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / DynamicData / DynamicData / DynamicRouteExpression.cs / 1305376 / DynamicRouteExpression.cs
using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Web.DynamicData.Util; using System.Web.UI; using System.Web.UI.WebControls; using System.Diagnostics; #if ORYX_VNEXT using Microsoft.Web.Data.UI.WebControls.Expressions; using Microsoft.Web.Data.UI.WebControls; #else using System.Web.UI.WebControls.Expressions; #endif namespace System.Web.DynamicData { ////// This class is an QueryExtender-based equivalent of DynamicQueryStringParameters. /// When applied to a data source it will filter the data by the value of a primary key encoded /// in the requests query string (or potentially routing if complex routes are used). If ColumnName /// is specified it will retrieve the values /// public class DynamicRouteExpression : DataSourceExpression { private PropertyExpression _expression = new PropertyExpression(); ////// An optional column name that can be used to change the filtering mode (i.e. filter by foreign key instead /// of primary key). /// [DefaultValue("")] public string ColumnName { get; set; } ////// See base class. /// public override void SetContext(Control owner, HttpContext context, IQueryableDataSource dataSource) { base.SetContext(owner, context, dataSource); owner.Page.InitComplete += new EventHandler(Page_InitComplete); } void Page_InitComplete(object sender, EventArgs e) { Debug.Assert(DataSource != null); var table = DataSource.GetMetaTable(); IEnumerableparameters = RouteParametersHelper.GetColumnParameters(table, ColumnName); parameters.ToList().ForEach(p => _expression.Parameters.Add(p)); } /// /// See base class. /// public override IQueryable GetQueryable(IQueryable source) { return _expression.GetQueryable(source); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Web.DynamicData.Util; using System.Web.UI; using System.Web.UI.WebControls; using System.Diagnostics; #if ORYX_VNEXT using Microsoft.Web.Data.UI.WebControls.Expressions; using Microsoft.Web.Data.UI.WebControls; #else using System.Web.UI.WebControls.Expressions; #endif namespace System.Web.DynamicData { ////// This class is an QueryExtender-based equivalent of DynamicQueryStringParameters. /// When applied to a data source it will filter the data by the value of a primary key encoded /// in the requests query string (or potentially routing if complex routes are used). If ColumnName /// is specified it will retrieve the values /// public class DynamicRouteExpression : DataSourceExpression { private PropertyExpression _expression = new PropertyExpression(); ////// An optional column name that can be used to change the filtering mode (i.e. filter by foreign key instead /// of primary key). /// [DefaultValue("")] public string ColumnName { get; set; } ////// See base class. /// public override void SetContext(Control owner, HttpContext context, IQueryableDataSource dataSource) { base.SetContext(owner, context, dataSource); owner.Page.InitComplete += new EventHandler(Page_InitComplete); } void Page_InitComplete(object sender, EventArgs e) { Debug.Assert(DataSource != null); var table = DataSource.GetMetaTable(); IEnumerableparameters = RouteParametersHelper.GetColumnParameters(table, ColumnName); parameters.ToList().ForEach(p => _expression.Parameters.Add(p)); } /// /// See base class. /// public override IQueryable GetQueryable(IQueryable source) { return _expression.GetQueryable(source); } } } // 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
- Expr.cs
- CasesDictionary.cs
- SqlCommandBuilder.cs
- OpenFileDialog.cs
- DesignerTransaction.cs
- PageCatalogPart.cs
- PanelStyle.cs
- wgx_commands.cs
- ConstructorNeedsTagAttribute.cs
- Size.cs
- ReferenceService.cs
- XmlWellformedWriter.cs
- SerTrace.cs
- DynamicMethod.cs
- SafeIUnknown.cs
- ButtonFlatAdapter.cs
- MsmqDecodeHelper.cs
- Binding.cs
- RoutedCommand.cs
- TableItemStyle.cs
- IgnoreSectionHandler.cs
- NavigatingCancelEventArgs.cs
- SettingsBase.cs
- ResourceKey.cs
- FileDataSourceCache.cs
- GenericTypeParameterBuilder.cs
- ViewStateException.cs
- ReferentialConstraint.cs
- SharedDp.cs
- CollectionViewProxy.cs
- EventListenerClientSide.cs
- Translator.cs
- SmiConnection.cs
- PathFigureCollectionValueSerializer.cs
- GifBitmapEncoder.cs
- InternalCache.cs
- RSAOAEPKeyExchangeDeformatter.cs
- PrivateFontCollection.cs
- ConfigurationStrings.cs
- SafeEventLogWriteHandle.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ClientUtils.cs
- MulticastDelegate.cs
- HWStack.cs
- ControlEvent.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- BoundsDrawingContextWalker.cs
- basecomparevalidator.cs
- Size3DValueSerializer.cs
- Size.cs
- InvalidCastException.cs
- ThicknessConverter.cs
- ProjectedWrapper.cs
- InheritablePropertyChangeInfo.cs
- NamedPipeProcessProtocolHandler.cs
- HandledMouseEvent.cs
- ScrollViewer.cs
- CompilerInfo.cs
- EntityConnectionStringBuilder.cs
- Base64Decoder.cs
- Asn1Utilities.cs
- StrokeSerializer.cs
- WebBodyFormatMessageProperty.cs
- Helper.cs
- ISessionStateStore.cs
- AuthorizationSection.cs
- BitmapSizeOptions.cs
- TimeSpanStorage.cs
- ObjectStateManager.cs
- ObjectRef.cs
- SystemIcons.cs
- XmlMembersMapping.cs
- PinProtectionHelper.cs
- ListChangedEventArgs.cs
- SharedPersonalizationStateInfo.cs
- ToolStripDropDownItem.cs
- XmlSchemaAttributeGroup.cs
- RequestCachePolicy.cs
- ZipIOLocalFileHeader.cs
- ScrollChrome.cs
- ModelItemExtensions.cs
- RequestValidator.cs
- DeflateStream.cs
- MarkupObject.cs
- PathData.cs
- HeaderUtility.cs
- CursorInteropHelper.cs
- AutoResetEvent.cs
- StringSorter.cs
- StateInitialization.cs
- FilterElement.cs
- ResourceCategoryAttribute.cs
- XPathSelfQuery.cs
- GeneralTransform3D.cs
- PolicyException.cs
- TaskScheduler.cs
- TextBoxDesigner.cs
- DataGridViewDataErrorEventArgs.cs
- ControlType.cs
- WebPartConnectionsCancelEventArgs.cs