Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 115 additions & 74 deletions System.Linq.Dynamic.Core.sln

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions src-android/TestSLDC/MainPage.xaml.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected Type ResolveTypeBySimpleName([NotNull] IEnumerable<Assembly> assemblie
return null;
}

#if (WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if (WINDOWS_APP || UAP10_0 || NETSTANDARD)
/// <summary>
/// Gets the assembly types annotated with <see cref="DynamicLinqTypeAttribute"/> in an Exception friendly way.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/System.Linq.Dynamic.Core/DefaultAssemblyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Assembly[] GetAssemblies()
return assemblies.ToArray();
}

#elif DOTNET5_1 || WINDOWS_APP || UAP10_0 || NETSTANDARD || WPSL
#elif WINDOWS_APP || UAP10_0 || NETSTANDARD || WPSL
public Assembly[] GetAssemblies()
{
throw new NotSupportedException();
Expand Down
6 changes: 3 additions & 3 deletions src/System.Linq.Dynamic.Core/DynamicClassFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public static class DynamicClassFactory
private static readonly CustomAttributeBuilder DebuggerHiddenAttributeBuilder = new CustomAttributeBuilder(typeof(DebuggerHiddenAttribute).GetConstructor(EmptyTypes), new object[0]);

private static readonly ConstructorInfo ObjectCtor = typeof(object).GetConstructor(EmptyTypes);
#if WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD
#if WINDOWS_APP || UAP10_0 || NETSTANDARD
private static readonly MethodInfo ObjectToString = typeof(object).GetMethod("ToString", BindingFlags.Instance | BindingFlags.Public);
#else
private static readonly MethodInfo ObjectToString = typeof(object).GetMethod("ToString", BindingFlags.Instance | BindingFlags.Public, null, EmptyTypes, null);
#endif

private static readonly ConstructorInfo StringBuilderCtor = typeof(StringBuilder).GetConstructor(EmptyTypes);
#if WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD
#if WINDOWS_APP || UAP10_0 || NETSTANDARD
private static readonly MethodInfo StringBuilderAppendString = typeof(StringBuilder).GetMethod("Append", new[] { typeof(string) });
private static readonly MethodInfo StringBuilderAppendObject = typeof(StringBuilder).GetMethod("Append", new[] { typeof(object) });
#else
Expand All @@ -50,7 +50,7 @@ public static class DynamicClassFactory

private static readonly Type EqualityComparer = typeof(EqualityComparer<>);
private static readonly Type EqualityComparerGenericArgument = EqualityComparer.GetGenericArguments()[0];
#if WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD
#if WINDOWS_APP || UAP10_0 || NETSTANDARD
private static readonly MethodInfo EqualityComparerDefault = EqualityComparer.GetMethod("get_Default", BindingFlags.Static | BindingFlags.Public);
private static readonly MethodInfo EqualityComparerEquals = EqualityComparer.GetMethod("Equals", new[] { EqualityComparerGenericArgument, EqualityComparerGenericArgument });
private static readonly MethodInfo EqualityComparerGetHashCode = EqualityComparer.GetMethod("GetHashCode", new[] { EqualityComparerGenericArgument });
Expand Down
6 changes: 3 additions & 3 deletions src/System.Linq.Dynamic.Core/Exceptions/ParseException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Globalization;

#if !(SILVERLIGHT || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD || PORTABLE || WPSL)
#if !(SILVERLIGHT || WINDOWS_APP || UAP10_0 || NETSTANDARD || PORTABLE || WPSL)
using System.Runtime.Serialization;
#endif

Expand All @@ -9,7 +9,7 @@ namespace System.Linq.Dynamic.Core.Exceptions
/// <summary>
/// Represents errors that occur while parsing dynamic linq string expressions.
/// </summary>
#if !(SILVERLIGHT || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD || PORTABLE || WPSL || NETSTANDARD2_0)
#if !(SILVERLIGHT || WINDOWS_APP || UAP10_0 || NETSTANDARD || PORTABLE || WPSL || NETSTANDARD2_0)
[Serializable]
#endif
public sealed class ParseException : Exception
Expand Down Expand Up @@ -39,7 +39,7 @@ public override string ToString()
return string.Format(CultureInfo.CurrentCulture, Res.ParseExceptionFormat, Message, Position);
}

#if !(SILVERLIGHT || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD || PORTABLE || WPSL || NETSTANDARD2_0)
#if !(SILVERLIGHT || WINDOWS_APP || UAP10_0 || NETSTANDARD || PORTABLE || WPSL || NETSTANDARD2_0)
ParseException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand Down
2 changes: 1 addition & 1 deletion src/System.Linq.Dynamic.Core/Parser/ExpressionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,7 @@ static Exception IncompatibleOperandsError(string opName, Expression left, Expre

static MemberInfo FindPropertyOrField(Type type, string memberName, bool staticAccess, ParsingConfig ParsingConfig)
{
#if !(NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
BindingFlags flags = BindingFlags.Public | BindingFlags.DeclaredOnly | (staticAccess ? BindingFlags.Static : BindingFlags.Instance);
foreach (Type t in TypeHelper.GetSelfAndBaseTypes(type))
{
Expand Down
12 changes: 7 additions & 5 deletions src/System.Linq.Dynamic.Core/Parser/ExpressionPromoter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public virtual Expression Promote(Expression expr, Type type, bool exact, bool c
Type target = TypeHelper.GetNonNullableType(type);
object value = null;

#if !(NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
switch (Type.GetTypeCode(ce.Type))
{
case TypeCode.Int32:
Expand All @@ -70,12 +70,14 @@ public virtual Expression Promote(Expression expr, Type type, bool exact, bool c
#else
if (ce.Type == typeof(int) || ce.Type == typeof(uint) || ce.Type == typeof(long) || ce.Type == typeof(ulong))
{
value = _numberParser.ParseNumber(text, target);

// Make sure an enum value stays an enum value
// If target is an enum value, just use the Value from the ConstantExpression
if (target.GetTypeInfo().IsEnum)
{
value = Enum.ToObject(target, value);
value = Enum.ToObject(target, ce.Value);
}
else
{
value = _numberParser.ParseNumber(text, target);
}
}
else if (ce.Type == typeof(double))
Expand Down
2 changes: 1 addition & 1 deletion src/System.Linq.Dynamic.Core/Parser/NumberParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public object ParseNumber(string text, Type type)
{
try
{
#if !(NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
switch (Type.GetTypeCode(TypeHelper.GetNonNullableType(type)))
{
case TypeCode.SByte:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal static class PredefinedTypesHelper

static PredefinedTypesHelper()
{
#if !(NET35 || SILVERLIGHT || NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NET35 || SILVERLIGHT || NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
//System.Data.Entity is always here, so overwrite short name of it with EntityFramework if EntityFramework is found.
//EF5(or 4.x??), System.Data.Objects.DataClasses.EdmFunctionAttribute
//There is also an System.Data.Entity, Version=3.5.0.0, but no Functions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public bool ContainsMethod(Type type, string methodName, bool staticAccess, Expr

public int FindMethod(Type type, string methodName, bool staticAccess, ref Expression instance, ref Expression[] args, out MethodBase method)
{
#if !(NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
BindingFlags flags = BindingFlags.Public | BindingFlags.DeclaredOnly | (staticAccess ? BindingFlags.Static : BindingFlags.Instance);
foreach (Type t in SelfAndBaseTypes(type))
{
Expand Down Expand Up @@ -115,7 +115,7 @@ public int FindIndexer(Type type, Expression[] args, out MethodBase method)
if (members.Length != 0)
{
IEnumerable<MethodBase> methods = members.OfType<PropertyInfo>().
#if !(NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
Select(p => (MethodBase)p.GetGetMethod()).
Where(m => m != null);
#else
Expand Down
4 changes: 2 additions & 2 deletions src/System.Linq.Dynamic.Core/Parser/TypeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static Type FindGenericType(Type generic, Type type)

public static bool IsCompatibleWith(Type source, Type target)
{
#if !(NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
if (source == target)
{
return true;
Expand Down Expand Up @@ -288,7 +288,7 @@ private static int GetNumericTypeKind(Type type)
{
type = GetNonNullableType(type);

#if !(NETFX_CORE || WINDOWS_APP || DOTNET5_1 || UAP10_0 || NETSTANDARD)
#if !(NETFX_CORE || WINDOWS_APP || UAP10_0 || NETSTANDARD)
if (type.GetTypeInfo().IsEnum)
{
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/System.Linq.Dynamic.Core/ParsingConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public IDynamicLinkCustomTypeProvider CustomTypeProvider
{
get
{
#if !(DOTNET5_1 || WINDOWS_APP || UAP10_0 || NETSTANDARD)
#if !( WINDOWS_APP || UAP10_0 || NETSTANDARD)
// only use DefaultDynamicLinqCustomTypeProvider for full .NET Framework and NET Core App 2.x
return _customTypeProvider ?? (_customTypeProvider = new DefaultDynamicLinqCustomTypeProvider());
#else
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
<OutputType>Library</OutputType>
<RootNamespace>ExpressionSample.Droid</RootNamespace>
<AssemblyName>ExpressionSample.Android</AssemblyName>
<Deterministic>True</Deterministic>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1451" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Tabbar.xml" />
<AndroidResource Include="Resources\layout\Toolbar.xml" />
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\values\colors.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ExpressionSample\ExpressionSample.csproj">
<Project>{2B1797B7-A3CB-4405-A7D1-F44C378EBA4D}</Project>
<Name>ExpressionSample</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;

using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace ExpressionSample.Droid
{
[Activity(Label = "ExpressionSample", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

base.OnCreate(savedInstanceState);

Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);

base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.expressionsample">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="ExpressionSample.Android" android:theme="@style/MainTheme"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ExpressionSample.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExpressionSample.Android")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Loading