Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / WebControls / Expressions / PropertyExpression.cs / 1305376 / PropertyExpression.cs
#if ORYX_VNEXT namespace Microsoft.Web.Data.UI.WebControls.Expressions { using System.Web; using System.Web.UI.WebControls; #else namespace System.Web.UI.WebControls.Expressions { #endif using System; using System.Collections.Generic; using System.Security.Permissions; using System.Web.UI; using System.Linq.Expressions; using System.Linq; public class PropertyExpression : ParameterDataSourceExpression { public override IQueryable GetQueryable(IQueryable source) { if (source == null) { return null; } IDictionaryvalues = GetValues(); List equalsExpressions = new List (); ParameterExpression parameterExpression = Expression.Parameter(source.ElementType, String.Empty); foreach (KeyValuePair pair in values) { if (!String.IsNullOrEmpty(pair.Key)) { // Create the property expression Expression property = ExpressionHelper.CreatePropertyExpression(parameterExpression, pair.Key); // Get the value object value = ExpressionHelper.BuildObjectValue(pair.Value, property.Type); // Create Property == Value and '&&' the expressions together if (value != null) { Expression valueExpression = Expression.Constant(value, property.Type); Expression equalsExpression = Expression.Equal(property, valueExpression); equalsExpressions.Add(equalsExpression); } } } if (equalsExpressions.Any()) { Expression body = ExpressionHelper.And(equalsExpressions); return ExpressionHelper.Where(source, Expression.Lambda(body, parameterExpression)); } return 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
- ValidationError.cs
- SortDescriptionCollection.cs
- FrameDimension.cs
- QueryCacheEntry.cs
- FocusManager.cs
- ObjectItemCollection.cs
- AbstractDataSvcMapFileLoader.cs
- IgnoreSectionHandler.cs
- NodeFunctions.cs
- OverflowException.cs
- LocatorPartList.cs
- CommandValueSerializer.cs
- Window.cs
- PersonalizableTypeEntry.cs
- VersionedStreamOwner.cs
- CultureTable.cs
- RotateTransform3D.cs
- RadioButtonStandardAdapter.cs
- BeginStoryboard.cs
- UIElement.cs
- FileDialogCustomPlacesCollection.cs
- HwndHost.cs
- DBAsyncResult.cs
- FileLoadException.cs
- ContextMarshalException.cs
- PerfCounterSection.cs
- DeploymentExceptionMapper.cs
- ResourceKey.cs
- BitmapEffectrendercontext.cs
- panel.cs
- AutoResetEvent.cs
- ImageFormatConverter.cs
- _UncName.cs
- DataGridColumnFloatingHeader.cs
- WebBrowserDesigner.cs
- StyleHelper.cs
- FlowLayout.cs
- DataControlField.cs
- DeploymentSectionCache.cs
- GridViewRowEventArgs.cs
- WebConfigurationHost.cs
- ErrorEventArgs.cs
- XPathNode.cs
- ZipIOExtraField.cs
- StructuredTypeEmitter.cs
- ClientApiGenerator.cs
- SignatureResourcePool.cs
- DashStyle.cs
- SendParametersContent.cs
- SerializationInfoEnumerator.cs
- HttpWriter.cs
- CancellableEnumerable.cs
- XhtmlTextWriter.cs
- PcmConverter.cs
- TextRangeEditLists.cs
- BufferedWebEventProvider.cs
- CapiSafeHandles.cs
- ToolStripDropDownMenu.cs
- TimeoutException.cs
- ReadOnlyAttribute.cs
- OutKeywords.cs
- AutoResetEvent.cs
- PrintDocument.cs
- URLString.cs
- MaterialGroup.cs
- MouseEvent.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- TypographyProperties.cs
- CngUIPolicy.cs
- SecurityContext.cs
- MimeBasePart.cs
- PropertyReference.cs
- DatasetMethodGenerator.cs
- DashStyle.cs
- TextRenderingModeValidation.cs
- HttpHandlerActionCollection.cs
- RegexInterpreter.cs
- StringWriter.cs
- BufferedStream.cs
- ActivityCodeGenerator.cs
- Camera.cs
- RelOps.cs
- FormattedTextSymbols.cs
- DesignerCategoryAttribute.cs
- RefExpr.cs
- XmlElementAttribute.cs
- DataDesignUtil.cs
- GridViewRowPresenter.cs
- ACE.cs
- XmlSignatureProperties.cs
- SoapHeaderAttribute.cs
- SID.cs
- OdbcStatementHandle.cs
- SoapException.cs
- _AcceptOverlappedAsyncResult.cs
- LinqToSqlWrapper.cs
- InputScope.cs
- linebase.cs
- QilPatternFactory.cs
- ToolStripItemImageRenderEventArgs.cs