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
- PriorityBindingExpression.cs
- Trustee.cs
- ServicesExceptionNotHandledEventArgs.cs
- HwndAppCommandInputProvider.cs
- InlineObject.cs
- DrawingBrush.cs
- AlphabeticalEnumConverter.cs
- SmtpCommands.cs
- ImageField.cs
- TraceLevelHelper.cs
- MultiByteCodec.cs
- DateTimeConstantAttribute.cs
- CookieParameter.cs
- XmlSchemaIdentityConstraint.cs
- Executor.cs
- BaseTransportHeaders.cs
- ListItemCollection.cs
- SerializationAttributes.cs
- FileRecordSequenceHelper.cs
- ClientApiGenerator.cs
- UDPClient.cs
- SqlDataAdapter.cs
- SourceSwitch.cs
- TypefaceCollection.cs
- LocalizedNameDescriptionPair.cs
- Rect.cs
- TreeNodeConverter.cs
- ParameterCollection.cs
- LayoutManager.cs
- _AutoWebProxyScriptWrapper.cs
- ConsumerConnectionPoint.cs
- ToolStripCustomTypeDescriptor.cs
- InvalidProgramException.cs
- EmptyEnumerator.cs
- StringComparer.cs
- SecurityMessageProperty.cs
- CellTreeNodeVisitors.cs
- ConfigurationSchemaErrors.cs
- ScrollProperties.cs
- UiaCoreApi.cs
- ToolStripDropDown.cs
- AttributeEmitter.cs
- DesignerOptionService.cs
- EntityWrapper.cs
- MostlySingletonList.cs
- DateTimeSerializationSection.cs
- DispatchWrapper.cs
- TextElementEditingBehaviorAttribute.cs
- DetailsViewUpdatedEventArgs.cs
- InstanceNotFoundException.cs
- RequestCacheManager.cs
- StylusPointProperty.cs
- RowUpdatingEventArgs.cs
- TimeoutException.cs
- UniqueIdentifierService.cs
- Timeline.cs
- CompilerWrapper.cs
- EntityDataSourceContainerNameItem.cs
- Int64Storage.cs
- MetadataReference.cs
- HostingEnvironmentWrapper.cs
- SafeFileMappingHandle.cs
- FrameSecurityDescriptor.cs
- ListenerAdapter.cs
- OdbcReferenceCollection.cs
- JpegBitmapEncoder.cs
- PenCursorManager.cs
- XmlValidatingReaderImpl.cs
- WeakEventTable.cs
- XmlBinaryReader.cs
- Border.cs
- ExtensibleClassFactory.cs
- RuntimeCompatibilityAttribute.cs
- AdornerPresentationContext.cs
- HtmlTableCell.cs
- StateMachineSubscriptionManager.cs
- EnumDataContract.cs
- XmlText.cs
- ListViewItemSelectionChangedEvent.cs
- IPipelineRuntime.cs
- OdbcConnection.cs
- SwitchAttribute.cs
- EntityProviderFactory.cs
- ErrorFormatter.cs
- MenuBase.cs
- StaticExtensionConverter.cs
- OracleRowUpdatingEventArgs.cs
- BitmapEffectGroup.cs
- EntryWrittenEventArgs.cs
- CodeThrowExceptionStatement.cs
- ResourceIDHelper.cs
- HtmlTableCellCollection.cs
- GroupItemAutomationPeer.cs
- UpWmlMobileTextWriter.cs
- ResourceBinder.cs
- TemplateBindingExpressionConverter.cs
- Decoder.cs
- ListBoxAutomationPeer.cs
- FixUp.cs
- mda.cs