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
- DataSourceExpressionCollection.cs
- ChannelAcceptor.cs
- List.cs
- JpegBitmapEncoder.cs
- DrawingGroup.cs
- BrowserCapabilitiesFactory.cs
- FileIOPermission.cs
- CompatibleIComparer.cs
- XmlEntityReference.cs
- PrintingPermission.cs
- WebServiceClientProxyGenerator.cs
- SessionStateContainer.cs
- TextOutput.cs
- DbParameterCollection.cs
- RegistrationContext.cs
- Popup.cs
- GridViewRowEventArgs.cs
- TransactionState.cs
- X509ChainElement.cs
- MdiWindowListItemConverter.cs
- SqlCommandSet.cs
- PatternMatcher.cs
- MethodCallTranslator.cs
- GeneralTransformGroup.cs
- WpfSharedBamlSchemaContext.cs
- ActiveXContainer.cs
- NavigationPropertyEmitter.cs
- OleDbParameterCollection.cs
- SqlException.cs
- SchemaElementLookUpTableEnumerator.cs
- DataGridHeaderBorder.cs
- PagerSettings.cs
- AutoGeneratedFieldProperties.cs
- InputMethodStateChangeEventArgs.cs
- FileDialog_Vista.cs
- FactoryMaker.cs
- ConfigurationManagerInternalFactory.cs
- ConditionCollection.cs
- Padding.cs
- HyperlinkAutomationPeer.cs
- AdornerHitTestResult.cs
- Literal.cs
- PolicyManager.cs
- DataView.cs
- SmtpTransport.cs
- OleCmdHelper.cs
- BoolExpr.cs
- ManifestSignatureInformation.cs
- ClientSettings.cs
- ImageMap.cs
- XamlWrappingReader.cs
- BitmapSizeOptions.cs
- DelegatingHeader.cs
- FrameworkElementAutomationPeer.cs
- ConfigurationFileMap.cs
- XmlSerializerFaultFormatter.cs
- WpfKnownMemberInvoker.cs
- OleDbConnectionFactory.cs
- ZipPackage.cs
- NavigationProperty.cs
- XmlEntity.cs
- cache.cs
- ChannelEndpointElement.cs
- RadioButton.cs
- Attributes.cs
- StaticExtension.cs
- XMLDiffLoader.cs
- DataGridViewCellStyleChangedEventArgs.cs
- QueryGenerator.cs
- CollectionView.cs
- StylusPointDescription.cs
- MetabaseServerConfig.cs
- GenericIdentity.cs
- ExpressionBuilderCollection.cs
- XPathNode.cs
- RtfFormatStack.cs
- ContractsBCL.cs
- TimerEventSubscriptionCollection.cs
- DataObject.cs
- StaticFileHandler.cs
- ViewUtilities.cs
- TemplatePartAttribute.cs
- FormatException.cs
- AuthStoreRoleProvider.cs
- EditorPartCollection.cs
- MultipleFilterMatchesException.cs
- DataGridRelationshipRow.cs
- SourceSwitch.cs
- ModelServiceImpl.cs
- OdbcErrorCollection.cs
- MetadataCache.cs
- HMACSHA256.cs
- ReadOnlyCollectionBase.cs
- MiniMapControl.xaml.cs
- SessionStateItemCollection.cs
- arc.cs
- InputScopeManager.cs
- Timer.cs
- EndpointBehaviorElement.cs
- TdsParserHelperClasses.cs