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
- NonParentingControl.cs
- NoPersistHandle.cs
- WinFormsSecurity.cs
- ConfigXmlComment.cs
- SQLMoney.cs
- SchemaComplexType.cs
- DataGridViewCell.cs
- SmiContext.cs
- ToolStripGripRenderEventArgs.cs
- CompilerScopeManager.cs
- CoreSwitches.cs
- httpserverutility.cs
- XmlSchemaAppInfo.cs
- GridSplitter.cs
- ValueConversionAttribute.cs
- ClientSettingsStore.cs
- PrintController.cs
- SizeFConverter.cs
- GAC.cs
- SingleTagSectionHandler.cs
- XmlTextReaderImpl.cs
- WebDescriptionAttribute.cs
- FrameworkElement.cs
- ToolStripProgressBar.cs
- SessionStateContainer.cs
- NativeMethods.cs
- FixUpCollection.cs
- SynchronizationHandlesCodeDomSerializer.cs
- PropertyEntry.cs
- ToolboxComponentsCreatedEventArgs.cs
- Merger.cs
- AQNBuilder.cs
- Condition.cs
- IntegerCollectionEditor.cs
- PrincipalPermission.cs
- ToolboxDataAttribute.cs
- ReadOnlyDictionary.cs
- DataServiceBuildProvider.cs
- TextClipboardData.cs
- IntSecurity.cs
- NativeBuffer.cs
- CodeSnippetCompileUnit.cs
- TreeView.cs
- CollectionEditVerbManager.cs
- ObjectConverter.cs
- UnicodeEncoding.cs
- mda.cs
- VideoDrawing.cs
- RawTextInputReport.cs
- SortedDictionary.cs
- ValueOfAction.cs
- Int64Converter.cs
- PeerInputChannel.cs
- CurrencyManager.cs
- ErrorFormatterPage.cs
- HttpEncoderUtility.cs
- TextServicesCompartmentContext.cs
- BaseContextMenu.cs
- GenericPrincipal.cs
- AbsoluteQuery.cs
- OdbcFactory.cs
- CommandHelpers.cs
- MailWriter.cs
- DropShadowBitmapEffect.cs
- WorkflowInstanceExtensionCollection.cs
- XPathMessageFilter.cs
- Stack.cs
- NetPeerTcpBindingElement.cs
- MenuItem.cs
- IBuiltInEvidence.cs
- WebPartDisplayModeEventArgs.cs
- MimeImporter.cs
- RoutingExtension.cs
- BitHelper.cs
- BitmapEffectDrawing.cs
- BrowsableAttribute.cs
- EncodingNLS.cs
- ProfileServiceManager.cs
- ClientRuntimeConfig.cs
- TimeManager.cs
- ISFTagAndGuidCache.cs
- XmlDeclaration.cs
- TypeConverter.cs
- ListItemViewAttribute.cs
- TableCellCollection.cs
- CheckoutException.cs
- FixedFlowMap.cs
- OleDbErrorCollection.cs
- SqlBuffer.cs
- SuppressMergeCheckAttribute.cs
- BlobPersonalizationState.cs
- WebControlAdapter.cs
- SplineQuaternionKeyFrame.cs
- TableRowGroup.cs
- ObjectDataSourceEventArgs.cs
- LogWriteRestartAreaAsyncResult.cs
- MobileUserControlDesigner.cs
- EncoderFallback.cs
- LocationSectionRecord.cs
- AppDomainManager.cs