From c4c1057294d5982e4c95da38eb878a8ab47d3c4e Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Wed, 27 Mar 2019 21:22:07 +0800 Subject: [PATCH] add tests GroupPrimaryKeys --- .../DataAnnotations/MySqlFluentTest.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/FreeSql.Tests/DataAnnotations/MySqlFluentTest.cs b/FreeSql.Tests/DataAnnotations/MySqlFluentTest.cs index 9d098d45..c66ad9b8 100644 --- a/FreeSql.Tests/DataAnnotations/MySqlFluentTest.cs +++ b/FreeSql.Tests/DataAnnotations/MySqlFluentTest.cs @@ -1,8 +1,16 @@ using FreeSql.DataAnnotations; +using FreeSql.Tests.DataContext.SqlServer; using Xunit; namespace FreeSql.Tests.DataAnnotations { public class MySqlFluentTest { + + SqlServerFixture _sqlserverFixture; + + public MySqlFluentTest(SqlServerFixture sqlserverFixture) { + _sqlserverFixture = sqlserverFixture; + } + [Fact] public void Fluent() { g.mysql.CodeFirst @@ -36,6 +44,15 @@ namespace FreeSql.Tests.DataAnnotations { var t2 = g.mysql.Select(t2lastId + 1).ToOne(); } + [Fact] + public void GroupPrimaryKey() { + _sqlserverFixture.SqlServer.CodeFirst.SyncStructure(); + g.mysql.CodeFirst.SyncStructure(); + g.pgsql.CodeFirst.SyncStructure(); + g.sqlite.CodeFirst.SyncStructure(); + g.oracle.CodeFirst.SyncStructure(); + } + class TestFluenttb1 { public int Id { get; set; } @@ -49,6 +66,17 @@ namespace FreeSql.Tests.DataAnnotations { [Column(Name = "Idx", IsPrimary = true, IsIdentity = false)] public int Id { get; set; } + public string name { get; set; } = "defaultValue"; + } + + [Table(Name = "test_groupkey")] + class TestgroupkeyTb { + [Column(IsPrimary = true)] + public int Id { get; set; } + [Column(IsPrimary = true)] + public int id2 { get; set; } + + public string name { get; set; } = "defaultValue"; } }