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;
}
IDictionary values = 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
- EmptyCollection.cs
- ToolStripItemRenderEventArgs.cs
- ProjectionNode.cs
- ADConnectionHelper.cs
- EntityUtil.cs
- QuerySubExprEliminator.cs
- BaseCollection.cs
- PeerEndPoint.cs
- TableLayoutStyleCollection.cs
- TypeBuilderInstantiation.cs
- MetafileHeaderWmf.cs
- RankException.cs
- XmlFormatWriterGenerator.cs
- COAUTHIDENTITY.cs
- SharedPersonalizationStateInfo.cs
- AuthenticatedStream.cs
- JobInputBins.cs
- AuthorizationRuleCollection.cs
- ImageSourceConverter.cs
- ComplexType.cs
- ToolStripRendererSwitcher.cs
- DataGridViewHeaderCell.cs
- InputProcessorProfiles.cs
- InvalidCastException.cs
- XmlSchemaSet.cs
- SafeProcessHandle.cs
- UnsignedPublishLicense.cs
- SizeF.cs
- CookieHandler.cs
- EventLogPermissionEntry.cs
- SHA384Cng.cs
- DataKeyCollection.cs
- WindowsRebar.cs
- ToolStripSeparatorRenderEventArgs.cs
- RSAOAEPKeyExchangeDeformatter.cs
- InsufficientExecutionStackException.cs
- JournalEntry.cs
- SqlTypeSystemProvider.cs
- OleDbPropertySetGuid.cs
- InputLanguageManager.cs
- AssemblyFilter.cs
- EntityDesignerUtils.cs
- ButtonRenderer.cs
- AmbientLight.cs
- PriorityChain.cs
- NumericExpr.cs
- ConnectionStringsExpressionEditor.cs
- FillBehavior.cs
- SecurityPolicyVersion.cs
- ProgressPage.cs
- HideDisabledControlAdapter.cs
- RelationshipManager.cs
- TableLayoutStyleCollection.cs
- StyleBamlTreeBuilder.cs
- XmlElementCollection.cs
- coordinator.cs
- DesignDataSource.cs
- mongolianshape.cs
- TextEditorSpelling.cs
- GraphicsPath.cs
- FrameworkReadOnlyPropertyMetadata.cs
- EditingCommands.cs
- ParseChildrenAsPropertiesAttribute.cs
- EdmItemError.cs
- SqlXmlStorage.cs
- GroupQuery.cs
- WebServiceTypeData.cs
- Missing.cs
- Set.cs
- XmlValidatingReader.cs
- SharedUtils.cs
- InternalsVisibleToAttribute.cs
- RichTextBoxAutomationPeer.cs
- PtsContext.cs
- CopyAttributesAction.cs
- PropertyPanel.cs
- URLMembershipCondition.cs
- Transform.cs
- _WebProxyDataBuilder.cs
- PersonalizationState.cs
- ContentTextAutomationPeer.cs
- IconBitmapDecoder.cs
- LocatorPartList.cs
- SafeNativeMethods.cs
- HttpCookiesSection.cs
- WindowsEditBox.cs
- AcceleratedTokenProvider.cs
- TypeTypeConverter.cs
- ScriptManagerProxy.cs
- BinaryObjectWriter.cs
- WebPartChrome.cs
- COM2PictureConverter.cs
- SchemaNotation.cs
- FontNamesConverter.cs
- TabPage.cs
- MimeReflector.cs
- LinqDataSourceContextEventArgs.cs
- X509Utils.cs
- MarkupCompiler.cs
- XmlWrappingReader.cs