/// <summary> /// Initializes a new instance of the OrderedQueryableProxy class. /// </summary> /// <param name="wrapperScope">The wrapper scope.</param> /// <param name="underlyingImplementation">The underlying implementation of the proxy.</param> public OrderedQueryableProxy(IWrapperScope wrapperScope, System.Linq.IOrderedQueryable underlyingImplementation) { ExceptionUtilities.CheckArgumentNotNull(wrapperScope, "wrapperScope"); ExceptionUtilities.CheckArgumentNotNull(underlyingImplementation, "underlyingImplementation"); this.Scope = wrapperScope; this.underlyingImplementation = underlyingImplementation; }
/// <summary> /// Initializes a new instance of the OrderedQueryableProxy class. /// </summary> /// <param name="wrapperScope">The wrapper scope.</param> /// <param name="underlyingImplementation">The underlying implementation of the proxy.</param> public OrderedQueryableProxy(IWrapperScope wrapperScope, System.Linq.IOrderedQueryable <T> underlyingImplementation) { ExceptionUtilities.CheckArgumentNotNull(wrapperScope, "wrapperScope"); ExceptionUtilities.CheckArgumentNotNull(underlyingImplementation, "underlyingImplementation"); this.Scope = wrapperScope; this.underlyingImplementation = underlyingImplementation; }
/// <summary> /// Converts the Linq data to a commaseperated string including header. /// </summary> /// <param name="data">The data.</param> /// <param name="delimiter">The delimiter.</param> /// <param name="nullvalue">The nullvalue.</param> /// <returns></returns> public static string ToCSVString(this System.Linq.IOrderedQueryable data, string delimiter, string nullvalue) { StringBuilder csvdata = new StringBuilder(); string replaceFrom = delimiter.Trim(); string replaceDelimiter = ";"; System.Reflection.PropertyInfo[] headers = data.ElementType.GetProperties(); switch (replaceFrom) { case ";": replaceDelimiter = ":"; break; case ",": replaceDelimiter = "¸"; break; case "\t": replaceDelimiter = " "; break; default: break; } if (headers.Length > 0) { foreach (var head in headers) { csvdata.Append(head.Name.Replace("_", " ") + delimiter); } csvdata.Append("\n"); } foreach (var row in data) { var fields = row.GetType().GetProperties(); for (int i = 0; i < fields.Length; i++) { object value = null; try { value = fields[i].GetValue(row, null); } catch { } if (value != null) { csvdata.Append(value.ToString().Replace("\r", "\f").Replace("\n", " \f").Replace("_", " ").Replace(replaceFrom, replaceDelimiter) + delimiter); } else { csvdata.Append(nullvalue); csvdata.Append(delimiter); } } csvdata.Append("\n"); } return(csvdata.ToString()); }
/// <summary> /// Disposes the wrapped instance if it implements IDisposable. /// </summary> /// <param name="disposing">Whether or not to dispose managed resources</param> protected virtual void Dispose(bool disposing) { CallOrderUtilities.TryWrapArbitraryMethodCall( () => this.Dispose(), () => { var d = this.underlyingImplementation as IDisposable; if (d != null) { d.Dispose(); this.underlyingImplementation = null; } }); }
public void CanObtainFromCovariantIOrderedQueryable() { // If an ordered queryable is cast covariantly and then has ThenBy() called on it, // it depends on IOrderedEnumerable<TElement> also being covariant to allow for // that ThenBy() to be processed within Linq-to-objects, as otherwise there is no // equivalent ThenBy() overload to translate the call to. System.Linq.IOrderedQueryable <IComparable> ordered = System.Linq.Queryable.OrderBy( System.Linq.Queryable.Select( System.Linq.Queryable.AsQueryable( Enumerable.Range(0, 100) ), i => i.ToString()), i => i.Length); ordered = System.Linq.Queryable.ThenBy(ordered, i => i); string[] expected = Enumerable.Range(0, 100).Select(i => i.ToString()).OrderBy(i => i.Length).ThenBy(i => i).ToArray(); Assert.Equal(expected, ordered); }
public static System.Linq.IOrderedQueryable <TSource> ThenByDescending <TSource, TKey>(this System.Linq.IOrderedQueryable <TSource> source, System.Linq.Expressions.Expression <System.Func <TSource, TKey> > keySelector, System.Collections.Generic.IComparer <TKey> comparer) { return(default(System.Linq.IOrderedQueryable <TSource>)); }
public static System.Linq.IOrderedQueryable <TSource> ThenBy <TSource, TKey>(this System.Linq.IOrderedQueryable <TSource> source, System.Linq.Expressions.Expression <System.Func <TSource, TKey> > keySelector) { return(default(System.Linq.IOrderedQueryable <TSource>)); }
public static System.Linq.IOrderedQueryable <TSource> ThenBy <TSource, TKey>(this System.Linq.IOrderedQueryable <TSource> source, System.Linq.Expressions.Expression <System.Func <TSource, TKey> > keySelector, System.Collections.Generic.IComparer <TKey> comparer) { throw null; }
public static System.Linq.IOrderedQueryable <TSource> ThenBy <TSource, TKey>(this System.Linq.IOrderedQueryable <TSource> source, System.Linq.Expressions.Expression <System.Func <TSource, TKey> > keySelector) { throw null; }
/// <summary> /// Converts the Linq data to a commaseperated string including header. /// </summary> /// <param name="data">The data.</param> /// <param name="delimiter">The delimiter.</param> /// <returns></returns> public static string ToCSVString(this System.Linq.IOrderedQueryable data, string delimiter) { return(ToCSVString(data, "; ", null)); }
/// <summary> /// Converts the Linq data to a commaseperated string including header. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public static string ToCSVString(this System.Linq.IOrderedQueryable data) { return(ToCSVString(data, "; ")); }