Migrate NPocoTests

This commit is contained in:
Mole
2020-10-22 14:12:07 +02:00
parent 4f80ebd788
commit ba262648d9
7 changed files with 85 additions and 54 deletions

View File

@@ -53,9 +53,9 @@ namespace Umbraco.Tests.Benchmarks
for (var i = 0; i < 100; i++)
{
var sql = Sql.BuilderFor(SqlContext)
.Select<NPocoFetchTests.Thing1Dto>()
.From<NPocoFetchTests.Thing1Dto>()
.Where<NPocoFetchTests.Thing1Dto>(x => x.Name == "yada");
.Select<Thing1Dto>()
.From<Thing1Dto>()
.Where<Thing1Dto>(x => x.Name == "yada");
var sqlString = sql.SQL; // force-build the SQL
}
@@ -69,9 +69,9 @@ namespace Umbraco.Tests.Benchmarks
for (var i = 0; i < 100; i++)
{
var template = SqlTemplates.Get("test", s => s
.Select<NPocoFetchTests.Thing1Dto>()
.From<NPocoFetchTests.Thing1Dto>()
.Where<NPocoFetchTests.Thing1Dto>(x => x.Name == SqlTemplate.Arg<string>("name")));
.Select<Thing1Dto>()
.From<Thing1Dto>()
.Where<Thing1Dto>(x => x.Name == SqlTemplate.Arg<string>("name")));
var sql = template.Sql(new { name = "yada" });
@@ -79,5 +79,17 @@ namespace Umbraco.Tests.Benchmarks
}
}
[TableName("zbThing1")]
[PrimaryKey("id", AutoIncrement = false)]
[ExplicitColumns]
public class Thing1Dto
{
[Column("id")]
public int Id { get; set; }
[Column("name")]
public string Name { get; set; }
}
}
}