Compatible with .NET CORE

This commit is contained in:
sunkaixuan
2017-07-01 12:47:58 +08:00
parent e1aedf4732
commit 3f375cc304
5 changed files with 26 additions and 8 deletions

View File

@@ -632,7 +632,7 @@ namespace SqlSugar
{
if (result.IsValuable())
{
if (entityType.BaseType.IsValuable() && entityType.BaseType == PubConst.ModelType)
if (entityType.GetTypeInfo().BaseType.IsValuable() && entityType.GetTypeInfo().BaseType == PubConst.ModelType)
{
foreach (var item in result)
{
@@ -1478,7 +1478,7 @@ namespace SqlSugar
return this;
}
public ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, bool>> expression)
public new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, bool>> expression)
{
if (isWhere)
_Where(expression);

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
{
/// <summary>
/// In order to be compatible with .NET CORE, make sure that the two versions are consistent in syntax
/// </summary>
public static class CompatibleExtensions
{
public static Type GetTypeInfo(this Type typeInfo)
{
return typeInfo;
}
}
}

View File

@@ -97,7 +97,7 @@ namespace SqlSugar
new ISugarQueryable<T, T2> Where(Expression<Func<T, bool>> expression);
ISugarQueryable<T, T2> Where(Expression<Func<T, T2, bool>> expression);
ISugarQueryable<T, T2> WhereIF(bool isWhere,Expression<Func<T, bool>> expression);
new ISugarQueryable<T, T2> WhereIF(bool isWhere,Expression<Func<T, bool>> expression);
ISugarQueryable<T, T2> WhereIF(bool isWhere, Expression<Func<T, T2, bool>> expression);
#endregion
@@ -122,7 +122,7 @@ namespace SqlSugar
ISugarQueryable<T, T2, T3> Where(Expression<Func<T, T2, bool>> expression);
ISugarQueryable<T, T2, T3> Where(Expression<Func<T, T2, T3, bool>> expression);
ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, Expression<Func<T, bool>> expression);
new ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, Expression<Func<T, bool>> expression);
ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, Expression<Func<T, T2, bool>> expression);
ISugarQueryable<T, T2, T3> WhereIF(bool isWhere, Expression<Func<T, T2, T3, bool>> expression);
#endregion
@@ -188,7 +188,7 @@ namespace SqlSugar
ISugarQueryable<T, T2, T3, T4, T5> Where(Expression<Func<T, T2, T3, T4, T5, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, Expression<Func<T, bool>> expression);
new ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, Expression<Func<T, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, Expression<Func<T, T2, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, Expression<Func<T, T2, T3, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, bool>> expression);
@@ -323,7 +323,7 @@ namespace SqlSugar
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Where(Expression<Func<T, T2, T3, T4, T5, T6, T7, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> Where(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, bool>> expression);
new ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, T2, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, T2, T3, bool>> expression);
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> WhereIF(bool isWhere, Expression<Func<T, T2, T3, T4, bool>> expression);

View File

@@ -63,6 +63,7 @@
<Compile Include="Abstract\FilterProvider\FilterProvider.cs" />
<Compile Include="Abstract\InsertableProvider\InsertableProvider.cs" />
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
<Compile Include="CompatibleNetCore\CompatibleExtensions.cs" />
<Compile Include="Realization\MySql\CodeFirst\MySqlCodeFirst.cs" />
<Compile Include="Realization\MySql\DbFirst\MySqlDbFirst.cs" />
<Compile Include="Realization\MySql\DbMaintenance\MySqlDbMaintenance.cs" />

View File

@@ -5,7 +5,6 @@ using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
@@ -633,7 +632,7 @@ namespace SqlSugar
{
if (result.IsValuable())
{
if (entityType.GetTypeInfo().BaseType.IsValuable() && entityType.GetTypeInfo().BaseType == PubConst.ModelType)
if (entityType.BaseType.IsValuable() && entityType.BaseType == PubConst.ModelType)
{
foreach (var item in result)
{