使用SharedContext模式调整FreeSql.Tests的SqlServer连接。

This commit is contained in:
LambertW
2019-03-14 23:17:05 +08:00
parent 89ff4ca44d
commit f25dfe3a14
18 changed files with 246 additions and 78 deletions

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace FreeSql.Tests.DataContext.SqlServer
{
public class SqlServerFixture : IDisposable
{
public SqlServerFixture()
{
sqlServerLazy = new Lazy<IFreeSql>(() => new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=cms;Pooling=true;Max Pool Size=10")
//.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=(localdb)\\mssqllocaldb;Integrated Security=True;Initial Catalog=cms;Pooling=true;Max Pool Size=10")
.UseAutoSyncStructure(true)
.UseLazyLoading(true)
.Build());
// ... initialize data in the test database ...
}
public void Dispose()
{
// ... clean up test data from the database ...
}
private Lazy<IFreeSql> sqlServerLazy;
public IFreeSql SqlServer => sqlServerLazy.Value;
}
}