This commit is contained in:
sunkaixuan
2017-01-07 21:54:51 +08:00
commit 3363b2aa91
128 changed files with 6450 additions and 0 deletions

6
OrmTest/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

18
OrmTest/Models/School.cs Normal file
View File

@@ -0,0 +1,18 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest.Models
{
public class School
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
public string Name { get; set; }
public virtual List<Student> Students { get; set; }
}
}

24
OrmTest/Models/Student.cs Normal file
View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using System.Linq.Expressions;
namespace OrmTest.Models
{
[SugarTable("STudent")]
public class Student
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "ID")]
public int Id { get; set; }
public string Name { get; set; }
[SugarColumn(IsIgnore = true)]
public int SchoolId { get; set; }
public DateTime CreateTime { get; set; }
[SugarColumn(MappingKeys = "id,SchoolId")]
public virtual School School { get; set; }
}
}

68
OrmTest/OrmTest.csproj Normal file
View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB591654-0476-40AA-8508-784CF32BE239}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OrmTest</RootNamespace>
<AssemblyName>OrmTest</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Models\School.cs" />
<Compile Include="Models\Student.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SqlSugar\SqlSugar.csproj">
<Project>{489bb790-226c-4fad-8d1e-51d72a7ff8e5}</Project>
<Name>SqlSugar</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>

59
OrmTest/Program.cs Normal file
View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Linq.Expressions;
using SqlSugar;
using OrmTest.Models;
namespace OrmTest
{
class Program
{
static void Main(string[] args)
{
Expression<Func<Student, bool>> exp = it => it.Id > 0;
ExpressionContext expContext = new ExpressionContext(exp, ResolveExpressType.Single);
// var x = expContext.GetFiledName();
var xx = expContext.GetWhere();
var b = DateTime.Now;
var config = new AttrbuitesCofnig()
{
DbType = DbType.SqlServer,
ConnectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugar4XTest",
EntityNamespace = "SqlSugar4XTest.Models",
IsAutoCloseConnection = false
};
SqlSugarClient db = new SqlSugarClient(config);
for (int i = 0; i < 1; i++)
{
db.Database.IsEnableLogEvent = true;
db.Database.LogEventStarting = (sql, par) =>
{
Console.WriteLine(sql + " " + par);
};
var tb = db.Database.DbMaintenance.GetTableInfoList();
var tc = db.Database.DbMaintenance.GetColumnInfosByTableName("student");
//var list = db.Queryable<Student>()
// .JoinTable<School>((st,sc)=>st.SchoolId==sc.Id)
// .Where("id=2").Where(it => it.Name == "id").Where(it => it.Id > 0).ToList();
//var list2 = db.Queryable<Student>().Where(it => it.Name == "id").Where(it => it.Id > 0).ToList();
//var xx = db.SqlQuery<Student>("select * from Student");
//var cl = db.Database.DbMaintenance.GetColumnInfosByTableName("student");
}
var e = DateTime.Now;
var t = (e - b).TotalMilliseconds;
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("OrmTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OrmTest")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cb591654-0476-40aa-8508-784cf32be239")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
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.