修正单元测试
This commit is contained in:
parent
a7cd994d90
commit
a75c15125b
|
@ -5,8 +5,8 @@
|
|||
<connectionStrings>
|
||||
<add name="MSSQL" connectionString="Data Source=.;Initial Catalog=master;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
|
||||
<!--<add name="Membership" connectionString="Data Source=.;Initial Catalog=Membership;user id=sa;password=Pass@word" providerName="System.Data.SqlClient" />-->
|
||||
<add name="Membership" connectionString="Data Source=Membership.db;" providerName="Sqlite" />
|
||||
<add name="Membership.readonly2" connectionString="Data Source=Membership.db;ReadOnly=true;" providerName="Sqlite" />
|
||||
<add name="Membership" connectionString="Data Source=Data/Membership.db;" providerName="Sqlite" />
|
||||
<add name="Membership.readonly2" connectionString="Data Source=Data/Membership.db;ReadOnly=true;" providerName="Sqlite" />
|
||||
<!--<add name="Membership" connectionString="Data Source=:memory:;Pooling=true;Cache Size=-524288;Journal Mode=Memory;" providerName="Sqlite" />-->
|
||||
<!--<add name="Membership" connectionString="Server=.;Port=3306;Database=Membership;Uid=root;Pwd=root;" providerName="MySql.Data.MySqlClient"/>-->
|
||||
<!--<add name="Membership.readonly" connectionString="Server=.;Port=3306;Database=Membership;Uid=root;Pwd=root;" providerName="MySql.Data.MySqlClient"/>-->
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="https://newlifex.com https://newlifex.com/Model2022.xsd" NameSpace="XCode.Membership" ConnName="Membership" Output="Entity" BaseClass="Entity" Document="https://newlifex.com/xcode/model" Version="11.2.2022.0604" xmlns="https://newlifex.com/Model2022.xsd">
|
||||
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="https://newlifex.com https://newlifex.com/Model2022.xsd" NameSpace="XCode.Membership" ConnName="Membership" Output="Entity" BaseClass="Entity" Document="https://newlifex.com/xcode/model" Version="11.2.2022.0713" xmlns="https://newlifex.com/Model2022.xsd">
|
||||
<Table Name="User" Description="用户。用户帐号信息">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="https://newlifex.com https://newlifex.com/Model2022.xsd" NameSpace="XCode.Membership" ConnName="Membership" Output="Entity" BaseClass="Entity" Document="https://newlifex.com/xcode/model" Version="11.2.2022.0604" NameFormat="underline" xmlns="https://newlifex.com/Model2022.xsd">
|
||||
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="https://newlifex.com https://newlifex.com/Model2022.xsd" NameSpace="XCode.Membership" ConnName="Membership" Output="Entity" BaseClass="Entity" Document="https://newlifex.com/xcode/model" Version="11.2.2022.0713" NameFormat="underline" xmlns="https://newlifex.com/Model2022.xsd">
|
||||
<Table Name="User" Description="用户。用户帐号信息">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace XUnitTest.XCode.DataAccessLayer
|
|||
|
||||
using var conn = db.OpenConnection();
|
||||
connstr = conn.ConnectionString;
|
||||
Assert.EndsWith("characterset=utf8mb4;sslmode=None;allowpublickeyretrieval=True", connstr);
|
||||
Assert.EndsWith("characterset=utf8mb4;sslmode=Disabled;allowpublickeyretrieval=True", connstr);
|
||||
|
||||
var ver = db.ServerVersion;
|
||||
Assert.NotEmpty(ver);
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
<#@ template language="C#" hostSpecific="true" debug="true" #>
|
||||
<#@ assembly name="$(SolutionDir)\DLL\NewLife.Core.dll" #>
|
||||
<#@ assembly name="$(SolutionDir)\DLL\XCode.dll" #>
|
||||
<#@ import namespace="System.Diagnostics" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ import namespace="XCode.Code" #>
|
||||
<#@ output extension=".log" #>
|
||||
<#
|
||||
// 设置当前工作目录
|
||||
PathHelper.BasePath = Host.ResolvePath(".");
|
||||
|
||||
// 加载模型文件,得到数据表
|
||||
var option = new BuilderOption();
|
||||
var tables = ClassBuilder.LoadModels(null, option, out var atts);
|
||||
EntityBuilder.FixModelFile(null, option, atts, tables);
|
||||
|
||||
// 生成实体类
|
||||
//option.BaseClass = "I{name}";
|
||||
//option.ModelNameForCopy = "I{name}";
|
||||
EntityBuilder.BuildTables(tables, option, chineseFileName: true);
|
||||
|
||||
// 生成简易模型类
|
||||
option.Output = @"Output\EntityModels\";
|
||||
option.ClassNameTemplate = "{name}Model";
|
||||
option.ModelNameForCopy = "I{name}";
|
||||
//ClassBuilder.BuildModels(tables, option);
|
||||
|
||||
// 生成简易接口
|
||||
option.BaseClass = null;
|
||||
option.ClassNameTemplate = null;
|
||||
option.Output = @"Output\EntityInterfaces\";
|
||||
//ClassBuilder.BuildInterfaces(tables, option);
|
||||
|
||||
// 精确控制生成
|
||||
/*foreach (var item in tables)
|
||||
{
|
||||
var builder = new ClassBuilder
|
||||
{
|
||||
Table = item,
|
||||
Option = option.Clone(),
|
||||
};
|
||||
builder.Execute();
|
||||
builder.Save(null, true, false);
|
||||
}*/
|
||||
#>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://newlifex.com http://newlifex.com/Model2020.xsd" NameSpace="XUnitTest.XCode.TestEntity" ConnName="test" Output="" BaseClass="Entity" xmlns="http://newlifex.com/Model2020.xsd">
|
||||
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="https://newlifex.com https://newlifex.com/Model2022.xsd" NameSpace="XUnitTest.XCode.TestEntity" ConnName="test" Output="" BaseClass="Entity" Version="11.1.2022.0521" Document="https://newlifex.com/xcode/model" xmlns="https://newlifex.com/Model2022.xsd">
|
||||
<Table Name="User2" Description="用户">
|
||||
<Columns>
|
||||
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />
|
||||
|
@ -116,7 +116,6 @@
|
|||
<Index Columns="Action,Category" />
|
||||
<Index Columns="Action,Category,ID" />
|
||||
<Index Columns="Category,LinkID,ID" />
|
||||
<Index Columns="Category,LinkID,ID" />
|
||||
<Index Columns="CreateUserID,ID" />
|
||||
</Indexes>
|
||||
</Table>
|
||||
|
|
Binary file not shown.
|
@ -28,12 +28,6 @@
|
|||
<None Remove="TestEntity\Model.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="TestEntity\Build.tt">
|
||||
<PackagePath>content\Entity\</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>Build.log</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="TestEntity\Model.xml">
|
||||
<PackagePath>content\Entity\</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
|
|
Loading…
Reference in New Issue