Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / WebControls / QueryableDataSourceHelper.cs / 1305376 / QueryableDataSourceHelper.cs
#if ORYX_VNEXT namespace Microsoft.Web.Data.UI.WebControls { #else namespace System.Web.UI.WebControls { #endif using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Web; using System.Web.Resources; using System.Web.UI; using System.Web.UI.WebControls; internal static class QueryableDataSourceHelper { // This regular expression verifies that parameter names are set to valid identifiers. This validation // needs to match the parser's identifier validation as done in the default block of NextToken(). private static readonly string IdentifierPattern = @"^\s*[\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}_]" + // first character @"[\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}\p{Nd}\p{Pc}\p{Mn}\p{Mc}\p{Cf}_]*"; // remaining characters private static readonly Regex IdentifierRegex = new Regex(IdentifierPattern + @"\s*$"); private static readonly Regex AutoGenerateOrderByRegex = new Regex(IdentifierPattern + @"(\s+(asc|ascending|desc|descending))?\s*$", RegexOptions.IgnoreCase); // order operators internal static IQueryable AsQueryable(object o) { IQueryable oQueryable = o as IQueryable; if (oQueryable != null) { return oQueryable; } // Wrap strings in IEnumerableinstead of treating as IEnumerable . string oString = o as string; if (oString != null) { return Queryable.AsQueryable(new string[] { oString }); } IEnumerable oEnumerable = o as IEnumerable; if (oEnumerable != null) { // IEnumerable can be directly converted to an IQueryable . Type genericType = FindGenericEnumerableType(o.GetType()); if (genericType != null) { // The non-generic Queryable.AsQueryable gets called for array types, executing // the FindGenericType logic again. Might want to investigate way to avoid this. return Queryable.AsQueryable(oEnumerable); } // Wrap non-generic IEnumerables in IEnumerable
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MultiViewDesigner.cs
- UpDownEvent.cs
- DataGridCellClipboardEventArgs.cs
- Repeater.cs
- ListSourceHelper.cs
- InfoCardClaim.cs
- MatrixCamera.cs
- StaticFileHandler.cs
- RedistVersionInfo.cs
- DetailsViewDeletedEventArgs.cs
- InputScopeManager.cs
- UnsafeNetInfoNativeMethods.cs
- FactoryMaker.cs
- WindowsProgressbar.cs
- MediaTimeline.cs
- ECDiffieHellmanPublicKey.cs
- TextEditorSelection.cs
- WindowExtensionMethods.cs
- Variable.cs
- ListView.cs
- DataTableMappingCollection.cs
- UnsafeNativeMethodsCLR.cs
- TimeSpanMinutesConverter.cs
- TdsParserStaticMethods.cs
- UrlPropertyAttribute.cs
- MailWebEventProvider.cs
- CalendarButton.cs
- NameHandler.cs
- Material.cs
- CapabilitiesState.cs
- SettingsAttributes.cs
- FontInfo.cs
- CodeAttachEventStatement.cs
- ObjectDataSourceStatusEventArgs.cs
- TemplateControlParser.cs
- DomainUpDown.cs
- NativeWindow.cs
- ProfileService.cs
- CompModSwitches.cs
- MetaTableHelper.cs
- ApplicationActivator.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- DataServiceQueryOfT.cs
- errorpatternmatcher.cs
- RC2.cs
- sqlstateclientmanager.cs
- BindingValueChangedEventArgs.cs
- CodeMemberField.cs
- DetailsViewInsertEventArgs.cs
- DataGridViewRowsAddedEventArgs.cs
- BitmapFrameEncode.cs
- EraserBehavior.cs
- ADMembershipProvider.cs
- XmlILAnnotation.cs
- ImageListImage.cs
- SortableBindingList.cs
- KnownBoxes.cs
- SQLDateTime.cs
- WorkflowRuntimeServicesBehavior.cs
- Graphics.cs
- StateRuntime.cs
- TypeInfo.cs
- OrderPreservingPipeliningSpoolingTask.cs
- LayoutEditorPart.cs
- XmlSerializerObjectSerializer.cs
- ResourceWriter.cs
- AQNBuilder.cs
- SynchronizationLockException.cs
- TableLayout.cs
- Sentence.cs
- Scene3D.cs
- ResourceManagerWrapper.cs
- DataPagerFieldCommandEventArgs.cs
- AnnotationHelper.cs
- AlignmentXValidation.cs
- WinEventWrap.cs
- ImageConverter.cs
- HtmlProps.cs
- System.Data_BID.cs
- DictionaryManager.cs
- InvocationExpression.cs
- SerializationFieldInfo.cs
- SqlConnectionHelper.cs
- TransactionScopeDesigner.cs
- TypeDescriptionProvider.cs
- DataGridViewRowStateChangedEventArgs.cs
- BitVec.cs
- SmiEventSink.cs
- HtmlMeta.cs
- AssociatedControlConverter.cs
- SrgsGrammar.cs
- SoapAttributeAttribute.cs
- BaseUriHelper.cs
- AttachedPropertyBrowsableAttribute.cs
- ScriptControlManager.cs
- Win32KeyboardDevice.cs
- AuthorizationRule.cs
- XMLSyntaxException.cs
- Point.cs
- CoTaskMemHandle.cs