This commit is contained in:
sunkaixuan 2017-01-27 17:07:37 +08:00
parent 2b14283fd1
commit a928677842
29 changed files with 269 additions and 27 deletions

212
.gitignore vendored Normal file
View File

@ -0,0 +1,212 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +0,0 @@
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\bin\Debug\OrmTest.exe.config
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\bin\Debug\OrmTest.exe
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\bin\Debug\OrmTest.pdb
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\bin\Debug\SqlSugar.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\bin\Debug\Newtonsoft.Json.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\bin\Debug\SqlSugar.pdb
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\obj\Debug\OrmTest.csprojResolveAssemblyReference.cache
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\obj\Debug\OrmTest.exe
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\OrmTest\obj\Debug\OrmTest.pdb

Binary file not shown.

Binary file not shown.

View File

@ -17,5 +17,13 @@ namespace SqlSugar
public object CommonTempData { get; set; }
public List<KeyValuePair<string, BinaryExpressionInfo>> BinaryTempData { get; set; }
public ExpressionResultAppendType AppendType { get; set; }
public void IsAppendResult()
{
this.AppendType = ExpressionResultAppendType.AppendResult;
}
public void IsAppendTempDate()
{
this.AppendType = ExpressionResultAppendType.AppendTempDate;
}
}
}

View File

@ -7,7 +7,21 @@ namespace SqlSugar
{
public class ExpressionResult
{
public ExpressionParameter CurrentParameter { get; set; }
public bool IsLockCurrentParameter { get; set; }
private ExpressionParameter _CurrentParameter;
public ExpressionParameter CurrentParameter
{
get
{
return this._CurrentParameter;
}
set
{
Check.Exception(value!=null&&IsLockCurrentParameter, "CurrentParameter is locked.");
this._CurrentParameter = value;
this.IsLockCurrentParameter = false;
}
}
#region constructor
private ExpressionResult()
{
@ -58,7 +72,8 @@ namespace SqlSugar
public void Append(object parameter)
{
if (this.CurrentParameter.IsValuable() && this.CurrentParameter.AppendType.IsIn(ExpressionResultAppendType.AppendTempDate)) {
if (this.CurrentParameter.IsValuable() && this.CurrentParameter.AppendType.IsIn(ExpressionResultAppendType.AppendTempDate))
{
this.CurrentParameter.CommonTempData = parameter;
return;
}
@ -86,7 +101,7 @@ namespace SqlSugar
{
if (this.CurrentParameter.IsValuable() && this.CurrentParameter.AppendType.IsIn(ExpressionResultAppendType.AppendTempDate))
{
this.CurrentParameter.CommonTempData = new KeyValuePair<string,object[]>(parameter,orgs);
this.CurrentParameter.CommonTempData = new KeyValuePair<string, object[]>(parameter, orgs);
return;
}
switch (this._ResolveExpressType)

View File

@ -68,7 +68,7 @@ namespace SqlSugar
}
#endregion
#region functions
#region public functions
public virtual string GetaMppingColumnsName(string name)
{
return name;
@ -78,6 +78,10 @@ namespace SqlSugar
BaseResolve resolve = new BaseResolve(new ExpressionParameter() { Expression = this.Expression, Context = this });
resolve.Start();
}
public virtual string GetAsString(string fieldName, string fieldValue)
{
return string.Format(" {0} {1} {2} ", fieldValue, "AS", fieldName);
}
#endregion
}
}

View File

@ -12,8 +12,6 @@ namespace SqlSugar
if (parameter.BaseParameter.CommonTempData != null && parameter.BaseParameter.CommonTempData.Equals("simple"))
{
parameter.BaseParameter = parameter;
parameter.AppendType = ExpressionResultAppendType.AppendTempDate;
this.Context.Result.CurrentParameter = parameter;
new SimpleBinaryExpressionResolve(parameter);
this.Context.Result.CurrentParameter = null;
}

View File

@ -40,26 +40,45 @@ namespace SqlSugar
int i = 0;
foreach (var item in expression.Arguments)
{
string memberName = expression.Members[i].Name;
++i;
if (item.NodeType == ExpressionType.Constant || (item is MemberExpression) && ((MemberExpression)item).Expression.NodeType == ExpressionType.Constant)
{
base.Expression = item;
base.Start();
string parameterName = this.Context.SqlParameterKeyWord + "constant" + i;
parameter.Context.Result.Append(parameterName);
parameter.Context.Result.Append(base.Context.GetAsString(memberName,parameterName));
this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData));
}
else if (item is MemberExpression)
{
base.Expression = item;
base.Start();
if (base.Context.Result.IsLockCurrentParameter == false)
{
base.Context.Result.CurrentParameter = parameter;
base.Context.Result.IsLockCurrentParameter = true;
parameter.IsAppendTempDate();
base.Expression = item;
base.Start();
parameter.IsAppendResult();
base.Context.Result.Append(base.Context.GetAsString(memberName,parameter.CommonTempData.ObjToString()));
base.Context.Result.CurrentParameter = null;
}
}
else if (item is BinaryExpression)
{
base.Expression = item;
parameter.CommonTempData = "simple";
base.Start();
parameter.CommonTempData =null;
if (base.Context.Result.IsLockCurrentParameter == false)
{
base.Context.Result.CurrentParameter = parameter;
base.Context.Result.IsLockCurrentParameter = true;
parameter.IsAppendTempDate();
base.Expression = item;
parameter.CommonTempData = "simple";
base.Start();
parameter.CommonTempData = null;
parameter.IsAppendResult();
base.Context.Result.Append(base.Context.GetAsString(memberName, parameter.CommonTempData.ObjToString()));
base.Context.Result.CurrentParameter = null;
}
}
else
{

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +0,0 @@
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\SqlSugar.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\SqlSugar.pdb
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\Newtonsoft.Json.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.pdb

Binary file not shown.

Binary file not shown.