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 IEnumerable instead 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
- remotingproxy.cs
- ToolStripManager.cs
- WebPartConnectVerb.cs
- PrimaryKeyTypeConverter.cs
- Base64Decoder.cs
- PassportAuthentication.cs
- ConditionChanges.cs
- XmlSchemaInferenceException.cs
- DefaultExpressionVisitor.cs
- RtfToken.cs
- InvokeBase.cs
- FormatVersion.cs
- DecimalAnimationUsingKeyFrames.cs
- DataGridViewRowPostPaintEventArgs.cs
- XmlRootAttribute.cs
- InputLanguageCollection.cs
- CompiledRegexRunnerFactory.cs
- ObjectMemberMapping.cs
- codemethodreferenceexpression.cs
- EventToken.cs
- ControlPropertyNameConverter.cs
- XmlCompatibilityReader.cs
- MappingItemCollection.cs
- MembershipValidatePasswordEventArgs.cs
- SqlCacheDependencySection.cs
- ItemCheckEvent.cs
- KeyValueConfigurationCollection.cs
- PartitionedDataSource.cs
- QilLiteral.cs
- SchemaMerger.cs
- Exceptions.cs
- FormConverter.cs
- WindowPattern.cs
- ModelItemKeyValuePair.cs
- Attributes.cs
- DocumentAutomationPeer.cs
- ApplicationServiceManager.cs
- DBCommandBuilder.cs
- UInt16.cs
- Calendar.cs
- DataPagerField.cs
- Authorization.cs
- XmlRawWriterWrapper.cs
- JsonFormatMapping.cs
- WebPartEditVerb.cs
- SqlFactory.cs
- OdbcDataAdapter.cs
- StylusTip.cs
- SchemaSetCompiler.cs
- MachineSettingsSection.cs
- ImageAttributes.cs
- CalendarDay.cs
- XmlToDatasetMap.cs
- ClipboardData.cs
- TextServicesDisplayAttribute.cs
- bindurihelper.cs
- InputProviderSite.cs
- JsonObjectDataContract.cs
- DBDataPermissionAttribute.cs
- Base64Encoder.cs
- XsltOutput.cs
- IIS7UserPrincipal.cs
- EncoderParameter.cs
- ArraySubsetEnumerator.cs
- Soap12FormatExtensions.cs
- BinaryUtilClasses.cs
- XslUrlEditor.cs
- FontNamesConverter.cs
- DataSourceCollectionBase.cs
- DateTimeValueSerializer.cs
- AffineTransform3D.cs
- Label.cs
- UnionExpr.cs
- StatusBarPanel.cs
- PagesSection.cs
- PolicyValidationException.cs
- DeploymentExceptionMapper.cs
- BindableAttribute.cs
- AspProxy.cs
- RangeValuePatternIdentifiers.cs
- Slider.cs
- GeometryHitTestParameters.cs
- StringFormat.cs
- NavigationProperty.cs
- ListItem.cs
- HttpDictionary.cs
- CellConstantDomain.cs
- LineBreak.cs
- PtsHost.cs
- entitydatasourceentitysetnameconverter.cs
- HebrewNumber.cs
- PathNode.cs
- WebSysDescriptionAttribute.cs
- EndOfStreamException.cs
- SmiContextFactory.cs
- LinearGradientBrush.cs
- ZipArchive.cs
- Durable.cs
- IndependentAnimationStorage.cs
- CodeTypeMember.cs