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
- Decimal.cs
- Margins.cs
- TypeForwardedToAttribute.cs
- HttpWriter.cs
- ClientBuildManager.cs
- BulletedListDesigner.cs
- FrameworkElement.cs
- BuildManagerHost.cs
- FormViewInsertedEventArgs.cs
- UiaCoreApi.cs
- LocalFileSettingsProvider.cs
- ResourcePermissionBaseEntry.cs
- Identity.cs
- GC.cs
- TagPrefixInfo.cs
- Propagator.cs
- Decimal.cs
- XmlUtf8RawTextWriter.cs
- MatcherBuilder.cs
- EntityDataSourceWrapper.cs
- ParagraphResult.cs
- VectorCollectionConverter.cs
- TextLine.cs
- UnmanagedHandle.cs
- DecimalAverageAggregationOperator.cs
- LinearGradientBrush.cs
- HtmlToClrEventProxy.cs
- MarkupCompilePass1.cs
- XmlAttribute.cs
- HtmlToClrEventProxy.cs
- ContentElementAutomationPeer.cs
- TreeViewHitTestInfo.cs
- ButtonBaseDesigner.cs
- OleDbInfoMessageEvent.cs
- RequestContextBase.cs
- ObjectListCommandEventArgs.cs
- ToolBarButtonClickEvent.cs
- PermissionRequestEvidence.cs
- QueryStringParameter.cs
- ProfileSettings.cs
- ReadOnlyTernaryTree.cs
- WorkflowDesignerMessageFilter.cs
- WindowProviderWrapper.cs
- MsdtcWrapper.cs
- EventLogConfiguration.cs
- ImpersonateTokenRef.cs
- HttpWebRequestElement.cs
- LoadedOrUnloadedOperation.cs
- TraceHandlerErrorFormatter.cs
- ServiceInstallComponent.cs
- MenuItemStyle.cs
- TextRunTypographyProperties.cs
- DesignerOptions.cs
- XsltCompileContext.cs
- AstTree.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- MobileControlPersister.cs
- GridViewSortEventArgs.cs
- PropertyGridEditorPart.cs
- Set.cs
- TCEAdapterGenerator.cs
- RemoteWebConfigurationHost.cs
- ListViewUpdatedEventArgs.cs
- UInt32Converter.cs
- StringResourceManager.cs
- TextTrailingCharacterEllipsis.cs
- MethodCallConverter.cs
- QilUnary.cs
- GridViewColumnHeader.cs
- InstanceKeyCompleteException.cs
- CodeCompileUnit.cs
- AsymmetricSignatureDeformatter.cs
- UnrecognizedAssertionsBindingElement.cs
- ExceptionValidationRule.cs
- VideoDrawing.cs
- XmlSchemaSubstitutionGroup.cs
- XsltException.cs
- SafeFileMapViewHandle.cs
- DataTableMappingCollection.cs
- VirtualPathUtility.cs
- ListDictionaryInternal.cs
- FileUtil.cs
- Oid.cs
- SmiMetaData.cs
- StructuralType.cs
- TablePattern.cs
- VectorConverter.cs
- EntityDesignerUtils.cs
- UpdatePanelTriggerCollection.cs
- HttpApplication.cs
- DataControlField.cs
- WhitespaceRuleReader.cs
- XmlProcessingInstruction.cs
- TypeConverter.cs
- XamlTreeBuilderBamlRecordWriter.cs
- Int32RectValueSerializer.cs
- CharKeyFrameCollection.cs
- MutexSecurity.cs
- DivideByZeroException.cs
- ConfigXmlWhitespace.cs