修复 IsIgnore 过滤字段后,查询的错误;

This commit is contained in:
28810
2019-04-18 11:21:12 +08:00
parent b33536e4df
commit 8d266a556e
11 changed files with 60 additions and 4 deletions

View File

@ -1,5 +1,6 @@
using FreeSql.DataAnnotations;
using FreeSql.Tests.DataContext.SqlServer;
using System;
using Xunit;
namespace FreeSql.Tests.DataAnnotations {
@ -56,5 +57,22 @@ namespace FreeSql.Tests.DataAnnotations {
public string name { get; set; } = "defaultValue";
}
[Fact]
public void IsIgnore() {
var item = new TestIsIgnore { };
Assert.Equal(1, g.mysql.Insert<TestIsIgnore>().AppendData(item).ExecuteAffrows());
var find = g.mysql.Select<TestIsIgnore>().Where(a => a.id == item.id).First();
Assert.NotNull(find);
Assert.Equal(item.id, find.id);
}
class TestIsIgnore {
public Guid id { get; set; }
[Column(IsIgnore = true)]
public bool isignore { get; set; }
}
}
}

View File

@ -1,5 +1,6 @@
using FreeSql.DataAnnotations;
using FreeSql.Tests.DataContext.SqlServer;
using System;
using Xunit;
namespace FreeSql.Tests.DataAnnotations {
@ -81,6 +82,23 @@ namespace FreeSql.Tests.DataAnnotations {
public string name { get; set; } = "defaultValue";
}
[Fact]
public void IsIgnore() {
var item = new TestIsIgnore { };
Assert.Equal(1, _sqlserverFixture.SqlServer.Insert<TestIsIgnore>().AppendData(item).ExecuteAffrows());
var find = _sqlserverFixture.SqlServer.Select<TestIsIgnore>().Where(a => a.id == item.id).First();
Assert.NotNull(find);
Assert.Equal(item.id, find.id);
}
class TestIsIgnore {
public Guid id { get; set; }
[Column(IsIgnore = true)]
public bool isignore { get; set; }
}
}
}

View File

@ -246,6 +246,8 @@ namespace FreeSql.Tests.MySql {
}
[Fact]
public void ToOne() {
var testnotfind = select.Where("1=2").First(a => a.CreateTime);
Assert.Equal(default(DateTime), testnotfind);
}
[Fact]
public void ToSql() {

View File

@ -156,6 +156,8 @@ namespace FreeSql.Tests.Oracle {
}
[Fact]
public void ToOne() {
var testnotfind = select.Where("1=2").First(a => a.CreateTime);
Assert.Equal(default(DateTime), testnotfind);
}
[Fact]
public void ToSql() {

View File

@ -226,6 +226,8 @@ namespace FreeSql.Tests.PostgreSQL {
}
[Fact]
public void ToOne() {
var testnotfind = select.Where("1=2").First(a => a.CreateTime);
Assert.Equal(default(DateTime), testnotfind);
}
[Fact]
public void ToSql() {

View File

@ -158,6 +158,8 @@ namespace FreeSql.Tests.SqlServer {
}
[Fact]
public void ToOne() {
var testnotfind = select.Where("1=2").First(a => a.CreateTime);
Assert.Equal(default(DateTime), testnotfind);
}
[Fact]
public void ToSql() {

View File

@ -167,6 +167,8 @@ namespace FreeSql.Tests.Sqlite {
}
[Fact]
public void ToOne() {
var testnotfind = select.Where("1=2").First(a => a.CreateTime);
Assert.Equal(default(DateTime), testnotfind);
}
[Fact]
public void ToSql() {