diff --git a/Masa.Contrib.sln b/Masa.Contrib.sln index 33a587ed1..d43182911 100644 --- a/Masa.Contrib.sln +++ b/Masa.Contrib.sln @@ -96,7 +96,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Masa.Contrib.Configuration" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Service.MinimalAPIs.Tests", "test\Masa.Contrib.Service.MinimalAPIs.Tests\Masa.Contrib.Service.MinimalAPIs.Tests.csproj", "{A5C1EF6B-A3B5-4D0C-8373-F854EE7EF4AD}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contribs.Ddd.Domain.Entities.Tests", "test\Masa.Contribs.Ddd.Domain.Entities.Tests\Masa.Contribs.Ddd.Domain.Entities.Tests.csproj", "{B29ABF5D-AFA8-4480-B74E-3ACB6FAAA826}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Ddd.Domain.Entities.Tests", "test\Masa.Contrib.Ddd.Domain.Entities.Tests\Masa.Contrib.Ddd.Domain.Entities.Tests.csproj", "{B29ABF5D-AFA8-4480-B74E-3ACB6FAAA826}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.Contracts.EF.Tests", "test\Masa.Contrib.Data.Contracts.EF.Tests\Masa.Contrib.Data.Contracts.EF.Tests.csproj", "{5A163042-B03A-4063-85FF-22D4C5BB5B90}" EndProject @@ -168,39 +168,41 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Storage.Object EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Storage", "Storage", "{165391A5-034E-4894-8084-8DF7D4AA7518}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Configuration.AutoMap.NoArgumentConstructor.Tests", "test\Masa.Contrib.Configuration.AutoMap.NoArgumentConstructor.Tests\Masa.Contrib.Configuration.AutoMap.NoArgumentConstructor.Tests.csproj", "{B8358ED1-C95A-4EC0-9756-FB32C931F204}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Configuration.AutoMap.NoArgumentConstructor.Tests", "test\Masa.Contrib.Configuration.AutoMap.NoArgumentConstructor.Tests\Masa.Contrib.Configuration.AutoMap.NoArgumentConstructor.Tests.csproj", "{B8358ED1-C95A-4EC0-9756-FB32C931F204}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.BuildingBlocks.Data.Mapping", "src\BuildingBlocks\MASA.BuildingBlocks\src\Data\Masa.BuildingBlocks.Data.Mapping\Masa.BuildingBlocks.Data.Mapping.csproj", "{5A3338F1-9963-4CAC-85A3-7AB263CB15B0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.BuildingBlocks.Data.Mapping", "src\BuildingBlocks\MASA.BuildingBlocks\src\Data\Masa.BuildingBlocks.Data.Mapping\Masa.BuildingBlocks.Data.Mapping.csproj", "{5A3338F1-9963-4CAC-85A3-7AB263CB15B0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.Contracts.EF", "src\Data\Masa.Contrib.Data.Contracts.EF\Masa.Contrib.Data.Contracts.EF.csproj", "{79D639DC-DDE4-45B1-884D-60B6908F528E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.Contracts.EF", "src\Data\Masa.Contrib.Data.Contracts.EF\Masa.Contrib.Data.Contracts.EF.csproj", "{79D639DC-DDE4-45B1-884D-60B6908F528E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.Mapping.Mapster.Tests", "test\Masa.Contrib.Data.Mapping.Mapster.Tests\Masa.Contrib.Data.Mapping.Mapster.Tests.csproj", "{834A12D0-FBED-45B3-86EA-5EA114C516B5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.Mapping.Mapster.Tests", "test\Masa.Contrib.Data.Mapping.Mapster.Tests\Masa.Contrib.Data.Mapping.Mapster.Tests.csproj", "{834A12D0-FBED-45B3-86EA-5EA114C516B5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.BuildingBlocks.Data", "src\BuildingBlocks\MASA.BuildingBlocks\src\Data\Masa.BuildingBlocks.Data\Masa.BuildingBlocks.Data.csproj", "{C3451307-3743-4911-A401-7F28889703D3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.BuildingBlocks.Data", "src\BuildingBlocks\MASA.BuildingBlocks\src\Data\Masa.BuildingBlocks.Data\Masa.BuildingBlocks.Data.csproj", "{C3451307-3743-4911-A401-7F28889703D3}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mapping", "Mapping", "{4AC23B67-52F9-44E5-9586-79A1DB73E6F7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore", "src\Data\Masa.Contrib.Data.EntityFrameworkCore\Masa.Contrib.Data.EntityFrameworkCore.csproj", "{87DD354D-4D48-4918-ACDE-A7FF62FA0DD8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore", "src\Data\Masa.Contrib.Data.EntityFrameworkCore\Masa.Contrib.Data.EntityFrameworkCore.csproj", "{87DD354D-4D48-4918-ACDE-A7FF62FA0DD8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.Mapping.Mapster", "src\Data\Mapping\Masa.Contrib.Data.Mapping.Mapster\Masa.Contrib.Data.Mapping.Mapster.csproj", "{D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.Mapping.Mapster", "src\Data\Mapping\Masa.Contrib.Data.Mapping.Mapster\Masa.Contrib.Data.Mapping.Mapster.csproj", "{D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.Cosmos", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Cosmos\Masa.Contrib.Data.EntityFrameworkCore.Cosmos.csproj", "{3236F880-3DC0-450F-A14D-8C87525845DD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.Tests", "test\Masa.Contrib.Data.EntityFrameworkCore.Tests\Masa.Contrib.Data.EntityFrameworkCore.Tests.csproj", "{E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.InMemory", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.InMemory\Masa.Contrib.Data.EntityFrameworkCore.InMemory.csproj", "{7E3FAE39-9CD1-46FA-A389-660008035DFB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Ddd.Domain.Integrated.Tests", "test\Masa.Contrib.Ddd.Domain.Integrated.Tests\Masa.Contrib.Ddd.Domain.Integrated.Tests.csproj", "{E868B34E-D1ED-412A-9382-954B84EDE80C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.MySql", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.MySql\Masa.Contrib.Data.EntityFrameworkCore.MySql.csproj", "{3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.Cosmos", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Cosmos\Masa.Contrib.Data.EntityFrameworkCore.Cosmos.csproj", "{C8A78B0F-BF6B-4317-8C22-535626C263EC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.Oracle", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Oracle\Masa.Contrib.Data.EntityFrameworkCore.Oracle.csproj", "{A42CCFB3-1C30-4A58-AB28-E28736BF5378}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.InMemory", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.InMemory\Masa.Contrib.Data.EntityFrameworkCore.InMemory.csproj", "{69778426-7179-4B0C-8398-2F3BECA0FE93}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.Pomelo.MySql", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Pomelo.MySql\Masa.Contrib.Data.EntityFrameworkCore.Pomelo.MySql.csproj", "{32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.MySql", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.MySql\Masa.Contrib.Data.EntityFrameworkCore.MySql.csproj", "{0D50F5EB-D580-4041-A6FA-F5373EF10566}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.PostgreSql", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.PostgreSql\Masa.Contrib.Data.EntityFrameworkCore.PostgreSql.csproj", "{A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.Oracle", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Oracle\Masa.Contrib.Data.EntityFrameworkCore.Oracle.csproj", "{84A64849-AD9C-4618-BC87-07CCE7AD7FE2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.Sqlite", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Sqlite\Masa.Contrib.Data.EntityFrameworkCore.Sqlite.csproj", "{C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.Pomelo.MySql", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Pomelo.MySql\Masa.Contrib.Data.EntityFrameworkCore.Pomelo.MySql.csproj", "{96B87330-1B65-4E79-A5AD-E2268A582434}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.SqlServer", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.SqlServer\Masa.Contrib.Data.EntityFrameworkCore.SqlServer.csproj", "{E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.PostgreSql", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.PostgreSql\Masa.Contrib.Data.EntityFrameworkCore.PostgreSql.csproj", "{124A4190-6B03-4A1C-B2BE-979DD1FB511F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Data.EntityFrameworkCore.Tests", "test\Masa.Contrib.Data.EntityFrameworkCore.Tests\Masa.Contrib.Data.EntityFrameworkCore.Tests.csproj", "{E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.Sqlite", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.Sqlite\Masa.Contrib.Data.EntityFrameworkCore.Sqlite.csproj", "{690D8379-B630-41FD-88F0-6D1EBB4BC3D4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Data.EntityFrameworkCore.SqlServer", "src\Data\Masa.Contrib.Data.EntityFrameworkCore.SqlServer\Masa.Contrib.Data.EntityFrameworkCore.SqlServer.csproj", "{7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -706,22 +708,6 @@ Global {5A3338F1-9963-4CAC-85A3-7AB263CB15B0}.Release|Any CPU.Build.0 = Release|Any CPU {5A3338F1-9963-4CAC-85A3-7AB263CB15B0}.Release|x64.ActiveCfg = Release|Any CPU {5A3338F1-9963-4CAC-85A3-7AB263CB15B0}.Release|x64.Build.0 = Release|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|x64.ActiveCfg = Debug|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|x64.Build.0 = Debug|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|Any CPU.Build.0 = Release|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|x64.ActiveCfg = Release|Any CPU - {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|x64.Build.0 = Release|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|x64.ActiveCfg = Debug|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|x64.Build.0 = Debug|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|Any CPU.Build.0 = Release|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|x64.ActiveCfg = Release|Any CPU - {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|x64.Build.0 = Release|Any CPU {79D639DC-DDE4-45B1-884D-60B6908F528E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {79D639DC-DDE4-45B1-884D-60B6908F528E}.Debug|Any CPU.Build.0 = Debug|Any CPU {79D639DC-DDE4-45B1-884D-60B6908F528E}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -730,6 +716,14 @@ Global {79D639DC-DDE4-45B1-884D-60B6908F528E}.Release|Any CPU.Build.0 = Release|Any CPU {79D639DC-DDE4-45B1-884D-60B6908F528E}.Release|x64.ActiveCfg = Release|Any CPU {79D639DC-DDE4-45B1-884D-60B6908F528E}.Release|x64.Build.0 = Release|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|x64.ActiveCfg = Debug|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Debug|x64.Build.0 = Debug|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|Any CPU.Build.0 = Release|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|x64.ActiveCfg = Release|Any CPU + {834A12D0-FBED-45B3-86EA-5EA114C516B5}.Release|x64.Build.0 = Release|Any CPU {C3451307-3743-4911-A401-7F28889703D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C3451307-3743-4911-A401-7F28889703D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3451307-3743-4911-A401-7F28889703D3}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -746,70 +740,14 @@ Global {87DD354D-4D48-4918-ACDE-A7FF62FA0DD8}.Release|Any CPU.Build.0 = Release|Any CPU {87DD354D-4D48-4918-ACDE-A7FF62FA0DD8}.Release|x64.ActiveCfg = Release|Any CPU {87DD354D-4D48-4918-ACDE-A7FF62FA0DD8}.Release|x64.Build.0 = Release|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Debug|x64.ActiveCfg = Debug|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Debug|x64.Build.0 = Debug|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Release|Any CPU.Build.0 = Release|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Release|x64.ActiveCfg = Release|Any CPU - {3236F880-3DC0-450F-A14D-8C87525845DD}.Release|x64.Build.0 = Release|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Debug|x64.ActiveCfg = Debug|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Debug|x64.Build.0 = Debug|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Release|Any CPU.Build.0 = Release|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Release|x64.ActiveCfg = Release|Any CPU - {7E3FAE39-9CD1-46FA-A389-660008035DFB}.Release|x64.Build.0 = Release|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Debug|x64.ActiveCfg = Debug|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Debug|x64.Build.0 = Debug|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Release|Any CPU.Build.0 = Release|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Release|x64.ActiveCfg = Release|Any CPU - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A}.Release|x64.Build.0 = Release|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Debug|x64.ActiveCfg = Debug|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Debug|x64.Build.0 = Debug|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Release|Any CPU.Build.0 = Release|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Release|x64.ActiveCfg = Release|Any CPU - {A42CCFB3-1C30-4A58-AB28-E28736BF5378}.Release|x64.Build.0 = Release|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Debug|x64.ActiveCfg = Debug|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Debug|x64.Build.0 = Debug|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Release|Any CPU.Build.0 = Release|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Release|x64.ActiveCfg = Release|Any CPU - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48}.Release|x64.Build.0 = Release|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Debug|x64.ActiveCfg = Debug|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Debug|x64.Build.0 = Debug|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Release|Any CPU.Build.0 = Release|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Release|x64.ActiveCfg = Release|Any CPU - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1}.Release|x64.Build.0 = Release|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Debug|x64.ActiveCfg = Debug|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Debug|x64.Build.0 = Debug|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Release|Any CPU.Build.0 = Release|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Release|x64.ActiveCfg = Release|Any CPU - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA}.Release|x64.Build.0 = Release|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Debug|x64.ActiveCfg = Debug|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Debug|x64.Build.0 = Debug|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Release|Any CPU.Build.0 = Release|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Release|x64.ActiveCfg = Release|Any CPU - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE}.Release|x64.Build.0 = Release|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|x64.ActiveCfg = Debug|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Debug|x64.Build.0 = Debug|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|Any CPU.Build.0 = Release|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|x64.ActiveCfg = Release|Any CPU + {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145}.Release|x64.Build.0 = Release|Any CPU {E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}.Debug|Any CPU.Build.0 = Debug|Any CPU {E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -818,6 +756,78 @@ Global {E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}.Release|Any CPU.Build.0 = Release|Any CPU {E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}.Release|x64.ActiveCfg = Release|Any CPU {E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3}.Release|x64.Build.0 = Release|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Debug|x64.ActiveCfg = Debug|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Debug|x64.Build.0 = Debug|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Release|Any CPU.Build.0 = Release|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Release|x64.ActiveCfg = Release|Any CPU + {E868B34E-D1ED-412A-9382-954B84EDE80C}.Release|x64.Build.0 = Release|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Debug|x64.ActiveCfg = Debug|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Debug|x64.Build.0 = Debug|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Release|Any CPU.Build.0 = Release|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Release|x64.ActiveCfg = Release|Any CPU + {C8A78B0F-BF6B-4317-8C22-535626C263EC}.Release|x64.Build.0 = Release|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Debug|x64.ActiveCfg = Debug|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Debug|x64.Build.0 = Debug|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Release|Any CPU.Build.0 = Release|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Release|x64.ActiveCfg = Release|Any CPU + {69778426-7179-4B0C-8398-2F3BECA0FE93}.Release|x64.Build.0 = Release|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Debug|x64.ActiveCfg = Debug|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Debug|x64.Build.0 = Debug|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Release|Any CPU.Build.0 = Release|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Release|x64.ActiveCfg = Release|Any CPU + {0D50F5EB-D580-4041-A6FA-F5373EF10566}.Release|x64.Build.0 = Release|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Debug|x64.ActiveCfg = Debug|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Debug|x64.Build.0 = Debug|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Release|Any CPU.Build.0 = Release|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Release|x64.ActiveCfg = Release|Any CPU + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2}.Release|x64.Build.0 = Release|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Debug|x64.ActiveCfg = Debug|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Debug|x64.Build.0 = Debug|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Release|Any CPU.Build.0 = Release|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Release|x64.ActiveCfg = Release|Any CPU + {96B87330-1B65-4E79-A5AD-E2268A582434}.Release|x64.Build.0 = Release|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Debug|x64.ActiveCfg = Debug|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Debug|x64.Build.0 = Debug|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Release|Any CPU.Build.0 = Release|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Release|x64.ActiveCfg = Release|Any CPU + {124A4190-6B03-4A1C-B2BE-979DD1FB511F}.Release|x64.Build.0 = Release|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Debug|x64.ActiveCfg = Debug|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Debug|x64.Build.0 = Debug|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Release|Any CPU.Build.0 = Release|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Release|x64.ActiveCfg = Release|Any CPU + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4}.Release|x64.Build.0 = Release|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Debug|x64.ActiveCfg = Debug|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Debug|x64.Build.0 = Debug|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Release|Any CPU.Build.0 = Release|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Release|x64.ActiveCfg = Release|Any CPU + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -833,6 +843,7 @@ Global {8C39C640-0E8A-43A7-890C-9742B6B70AA4} = {42DF7AAC-362C-48F4-B76A-BDEEEFF17CC9} {593A3114-D1E0-47ED-BC37-58E08886175B} = {42DF7AAC-362C-48F4-B76A-BDEEEFF17CC9} {DA885E64-C5E2-4C22-8C2A-26E68A593F29} = {509BDB5A-5D32-478F-BF27-F0470C18C7C9} + {9F6F9899-D5F1-444A-BE56-64F949550D22} = {42DF7AAC-362C-48F4-B76A-BDEEEFF17CC9} {2BE750A5-8AC7-457C-9BB2-6E3D5E2D23B8} = {38E6C400-90C0-493E-9266-C1602E229F1B} {ED301FA5-4E70-460B-A0D4-1D79D135769F} = {593A3114-D1E0-47ED-BC37-58E08886175B} {21180442-A6A5-4239-A2AD-33FF5BB80E72} = {42DF7AAC-362C-48F4-B76A-BDEEEFF17CC9} @@ -902,22 +913,23 @@ Global {97532A33-A591-4DF5-A2C0-72527B78ED82} = {38E6C400-90C0-493E-9266-C1602E229F1B} {165391A5-034E-4894-8084-8DF7D4AA7518} = {42DF7AAC-362C-48F4-B76A-BDEEEFF17CC9} {B8358ED1-C95A-4EC0-9756-FB32C931F204} = {9EEE31DA-3165-4CB3-AAE9-27CC3A4DE669} - {79D639DC-DDE4-45B1-884D-60B6908F528E} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {C3451307-3743-4911-A401-7F28889703D3} = {DC578D74-98F0-4F19-A230-CFA8DAEE0AF1} - {87DD354D-4D48-4918-ACDE-A7FF62FA0DD8} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {3236F880-3DC0-450F-A14D-8C87525845DD} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} {5A3338F1-9963-4CAC-85A3-7AB263CB15B0} = {DC578D74-98F0-4F19-A230-CFA8DAEE0AF1} + {79D639DC-DDE4-45B1-884D-60B6908F528E} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} {834A12D0-FBED-45B3-86EA-5EA114C516B5} = {38E6C400-90C0-493E-9266-C1602E229F1B} + {C3451307-3743-4911-A401-7F28889703D3} = {DC578D74-98F0-4F19-A230-CFA8DAEE0AF1} {4AC23B67-52F9-44E5-9586-79A1DB73E6F7} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {87DD354D-4D48-4918-ACDE-A7FF62FA0DD8} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} {D5EA7A25-0FD2-4545-9C1C-FF96E5E35145} = {4AC23B67-52F9-44E5-9586-79A1DB73E6F7} - {7E3FAE39-9CD1-46FA-A389-660008035DFB} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {3F19EBF9-A52E-4D64-8884-ECB16BE6A12A} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {A42CCFB3-1C30-4A58-AB28-E28736BF5378} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {32E7A2E4-EE91-4CEA-9EBD-9EFE1C03CF48} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {A50DC3FB-FD2A-4EF8-8333-4782DFFF0BF1} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {C8CE5B92-96A6-4FA1-9EEB-43A524DC54AA} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} - {E337EE1A-F6DB-4276-9CD6-DEBF224D7FDE} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} {E1096C8E-6EC1-45CB-9CA6-0ADD830CAAA3} = {38E6C400-90C0-493E-9266-C1602E229F1B} + {C8A78B0F-BF6B-4317-8C22-535626C263EC} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {69778426-7179-4B0C-8398-2F3BECA0FE93} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {0D50F5EB-D580-4041-A6FA-F5373EF10566} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {84A64849-AD9C-4618-BC87-07CCE7AD7FE2} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {96B87330-1B65-4E79-A5AD-E2268A582434} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {124A4190-6B03-4A1C-B2BE-979DD1FB511F} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {690D8379-B630-41FD-88F0-6D1EBB4BC3D4} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {7C7CEBAE-38A4-435D-BEC2-2425D58FABDC} = {E33ADF54-4D35-49B7-BDA6-412587CA39FF} + {E868B34E-D1ED-412A-9382-954B84EDE80C} = {13EDB361-AF88-4F89-B4AB-46622BCCBC37} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {40383055-CC50-4600-AD9A-53C14F620D03} diff --git a/src/BuildingBlocks/MASA.BuildingBlocks b/src/BuildingBlocks/MASA.BuildingBlocks index d3b46ae3d..9705a8aa6 160000 --- a/src/BuildingBlocks/MASA.BuildingBlocks +++ b/src/BuildingBlocks/MASA.BuildingBlocks @@ -1 +1 @@ -Subproject commit d3b46ae3d38a9892672725aec7e46af528cdeb01 +Subproject commit 9705a8aa6a65c4cfb07294732cef93d4589881e9 diff --git a/src/Data/Masa.Contrib.Data.EntityFrameworkCore/Masa.Contrib.Data.EntityFrameworkCore.csproj b/src/Data/Masa.Contrib.Data.EntityFrameworkCore/Masa.Contrib.Data.EntityFrameworkCore.csproj index da99ba079..cb32e9764 100644 --- a/src/Data/Masa.Contrib.Data.EntityFrameworkCore/Masa.Contrib.Data.EntityFrameworkCore.csproj +++ b/src/Data/Masa.Contrib.Data.EntityFrameworkCore/Masa.Contrib.Data.EntityFrameworkCore.csproj @@ -16,6 +16,7 @@ + diff --git a/src/Data/Masa.Contrib.Data.EntityFrameworkCore/MasaDbContext.cs b/src/Data/Masa.Contrib.Data.EntityFrameworkCore/MasaDbContext.cs index 8fae11b58..4ec61b4aa 100644 --- a/src/Data/Masa.Contrib.Data.EntityFrameworkCore/MasaDbContext.cs +++ b/src/Data/Masa.Contrib.Data.EntityFrameworkCore/MasaDbContext.cs @@ -6,7 +6,8 @@ namespace Masa.Contrib.Data.EntityFrameworkCore; public abstract class MasaDbContext : DbContext, IMasaDbContext { protected readonly IDataFilter? DataFilter; - protected readonly MasaDbContextOptions? Options; + protected readonly MasaDbContextOptions Options; + protected IDomainEventBus? DomainEventBus => Options.ServiceProvider.GetService(); public MasaDbContext(MasaDbContextOptions options) : base(options) { @@ -108,12 +109,33 @@ protected virtual void OnBeforeSaveChanges() } catch (Exception ex) { - throw new Exception("An error occured when intercept SaveChanges() or SaveChangesAsync()()", ex); + throw new Exception("An error occured when intercept SaveChanges() or SaveChangesAsync()", ex); } } + DomainEventEnqueueAsync(ChangeTracker).ConfigureAwait(false).GetAwaiter().GetResult(); } } + protected virtual async Task DomainEventEnqueueAsync(ChangeTracker changeTracker) + { + if (DomainEventBus == null) + return; + + var domainEntities = changeTracker + .Entries() + .Where(entry => entry.Entity.GetDomainEvents().Any()); + + var domainEvents = domainEntities + .SelectMany(entry => entry.Entity.GetDomainEvents()) + .ToList(); + + domainEntities.ToList() + .ForEach(entity => entity.Entity.ClearDomainEvents()); + + foreach (var domainEvent in domainEvents) + await DomainEventBus.Enqueue(domainEvent); + } + /// /// Automatic soft delete. /// diff --git a/src/Data/Masa.Contrib.Data.EntityFrameworkCore/_Imports.cs b/src/Data/Masa.Contrib.Data.EntityFrameworkCore/_Imports.cs index dee832c0a..790cf6da3 100644 --- a/src/Data/Masa.Contrib.Data.EntityFrameworkCore/_Imports.cs +++ b/src/Data/Masa.Contrib.Data.EntityFrameworkCore/_Imports.cs @@ -5,6 +5,8 @@ global using Masa.BuildingBlocks.Data; global using Masa.BuildingBlocks.Data.Contracts.DataFiltering; global using Masa.BuildingBlocks.Data.Options; +global using Masa.BuildingBlocks.Ddd.Domain.Entities; +global using Masa.BuildingBlocks.Ddd.Domain.Events; global using Masa.Contrib.Data.EntityFrameworkCore.Filters; global using Microsoft.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore.ChangeTracking; diff --git a/src/Data/Masa.Contrib.Data.UoW.EF/UnitOfWork.cs b/src/Data/Masa.Contrib.Data.UoW.EF/UnitOfWork.cs index 9a65a05d4..dff3321f4 100644 --- a/src/Data/Masa.Contrib.Data.UoW.EF/UnitOfWork.cs +++ b/src/Data/Masa.Contrib.Data.UoW.EF/UnitOfWork.cs @@ -50,6 +50,10 @@ public async Task CommitAsync(CancellationToken cancellationToken = default) await Context.Database.CommitTransactionAsync(cancellationToken); CommitState = CommitState.Commited; + + var domainEventBus = ServiceProvider.GetService(); + if (domainEventBus != null) + await domainEventBus.PublishQueueAsync(); } public async Task RollbackAsync(CancellationToken cancellationToken = default) diff --git a/src/Data/Masa.Contrib.Data.UoW.EF/_Imports.cs b/src/Data/Masa.Contrib.Data.UoW.EF/_Imports.cs index bfc1f48c3..87fb70f0c 100644 --- a/src/Data/Masa.Contrib.Data.UoW.EF/_Imports.cs +++ b/src/Data/Masa.Contrib.Data.UoW.EF/_Imports.cs @@ -4,6 +4,7 @@ global using Masa.BuildingBlocks.Data; global using Masa.BuildingBlocks.Data.Options; global using Masa.BuildingBlocks.Data.UoW; +global using Masa.BuildingBlocks.Ddd.Domain.Events; global using Masa.BuildingBlocks.Dispatcher.Events; global using Masa.Contrib.Data.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore; diff --git a/test/Masa.Contrib.Data.UoW.EF.Tests/TestUnitOfWork.cs b/test/Masa.Contrib.Data.UoW.EF.Tests/TestUnitOfWork.cs index 259c054f6..a8e17126c 100644 --- a/test/Masa.Contrib.Data.UoW.EF.Tests/TestUnitOfWork.cs +++ b/test/Masa.Contrib.Data.UoW.EF.Tests/TestUnitOfWork.cs @@ -1,6 +1,7 @@ // Copyright (c) MASA Stack All rights reserved. // Licensed under the MIT License. See LICENSE.txt in the project root for license information. +using Masa.BuildingBlocks.Ddd.Domain.Events; using Microsoft.Extensions.Options; namespace Masa.Contrib.Data.UoW.EF.Tests; @@ -299,5 +300,25 @@ public async Task TestGetConnectionStringAsyncReturnTest1() Assert.IsTrue(await connectionStringProvider.GetConnectionStringAsync() == connectionString); } + [TestMethod] + public async Task TestCommitReturnPublishQueueIsValid() + { + IServiceCollection services = new ServiceCollection(); + Mock domainEventBus = new(); + domainEventBus.Setup(eventBus => eventBus.PublishQueueAsync()).Verifiable(); + services.AddScoped(serviceProvider => domainEventBus.Object); + Mock eventBuilder = new(); + eventBuilder.Setup(eb => eb.Services).Returns(services).Verifiable(); + eventBuilder.Object.UseUoW(options => options.UseTestSqlite($"Data Source=test_{Guid.NewGuid()}")); + + var serviceProvider = services.BuildServiceProvider(); + var dbContext = serviceProvider.GetRequiredService(); + dbContext.Database.EnsureCreated(); + var unitOfWork = new UnitOfWork(serviceProvider); + var _ = unitOfWork.Transaction; + await unitOfWork.CommitAsync(); + domainEventBus.Verify(eventBus => eventBus.PublishQueueAsync(), Times.Once()); + } + private string GetDataBaseConnectionString(CustomDbContext dbContext) => dbContext.Database.GetConnectionString()!; } diff --git a/test/Masa.Contribs.Ddd.Domain.Entities.Tests/Masa.Contribs.Ddd.Domain.Entities.Tests.csproj b/test/Masa.Contrib.Ddd.Domain.Entities.Tests/Masa.Contrib.Ddd.Domain.Entities.Tests.csproj similarity index 100% rename from test/Masa.Contribs.Ddd.Domain.Entities.Tests/Masa.Contribs.Ddd.Domain.Entities.Tests.csproj rename to test/Masa.Contrib.Ddd.Domain.Entities.Tests/Masa.Contrib.Ddd.Domain.Entities.Tests.csproj diff --git a/test/Masa.Contribs.Ddd.Domain.Entities.Tests/Users.cs b/test/Masa.Contrib.Ddd.Domain.Entities.Tests/User.cs similarity index 67% rename from test/Masa.Contribs.Ddd.Domain.Entities.Tests/Users.cs rename to test/Masa.Contrib.Ddd.Domain.Entities.Tests/User.cs index d85d2d84a..ddd9654b2 100644 --- a/test/Masa.Contribs.Ddd.Domain.Entities.Tests/Users.cs +++ b/test/Masa.Contrib.Ddd.Domain.Entities.Tests/User.cs @@ -1,9 +1,9 @@ // Copyright (c) MASA Stack All rights reserved. // Licensed under the MIT License. See LICENSE.txt in the project root for license information. -namespace Masa.Contribs.Ddd.Domain.Entities.Tests; +namespace Masa.Contrib.Ddd.Domain.Entities.Tests; -public class Users : AggregateRoot +public class User : AggregateRoot { public string Name { get; set; } } diff --git a/test/Masa.Contribs.Ddd.Domain.Entities.Tests/_Imports.cs b/test/Masa.Contrib.Ddd.Domain.Entities.Tests/_Imports.cs similarity index 100% rename from test/Masa.Contribs.Ddd.Domain.Entities.Tests/_Imports.cs rename to test/Masa.Contrib.Ddd.Domain.Entities.Tests/_Imports.cs diff --git a/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/CustomizeDbContext.cs b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/CustomizeDbContext.cs new file mode 100644 index 000000000..67ff71ba7 --- /dev/null +++ b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/CustomizeDbContext.cs @@ -0,0 +1,15 @@ +// Copyright (c) MASA Stack All rights reserved. +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +using Masa.Contrib.Ddd.Domain.Entities.Tests; + +namespace Masa.Contrib.Ddd.Domain.Integrated.Tests; + +public class CustomizeDbContext : MasaDbContext +{ + public DbSet User { get; set; } + + public CustomizeDbContext(MasaDbContextOptions options) : base(options) + { + } +} diff --git a/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/DomainEventTest.cs b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/DomainEventTest.cs new file mode 100644 index 000000000..d15cf7d5b --- /dev/null +++ b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/DomainEventTest.cs @@ -0,0 +1,62 @@ +// Copyright (c) MASA Stack All rights reserved. +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +using Masa.BuildingBlocks.Data; +using Masa.BuildingBlocks.Ddd.Domain.Events; +using Masa.Contrib.Ddd.Domain.Integrated.Tests.DomainEvents; +using System.Collections.Concurrent; +using System.Linq; +using System.Threading.Tasks; +using Masa.Contrib.Ddd.Domain.Entities.Tests; + +namespace Masa.Contrib.Ddd.Domain.Integrated.Tests; + +[TestClass] +public class DomainEventTest +{ + private IServiceProvider _serviceProvider; + + [TestInitialize] + public void Initialize() + { + IServiceCollection services = new ServiceCollection(); + services.Configure(options => + { + options.ConnectionStrings = new ConnectionStrings() + { + DefaultConnection = $"Data Source=test_{Guid.NewGuid()}" + }; + }); + services.AddDomainEventBus(dispatchOptions => + { + dispatchOptions + .UseDaprEventBus(options => options.UseEventLog()) + .UseEventBus() + .UseUoW(dbOptions => dbOptions.UseSqlite()) + .UseRepository(); + }); + _serviceProvider = services.BuildServiceProvider(); + } + + [TestMethod] + public async Task TestSaveChangesReturnDomainEventBus() + { + var dbContext = _serviceProvider.GetRequiredService(); + await dbContext.Database.EnsureCreatedAsync(); + var user = new User() + { + Name = "Jim" + }; + user.AddDomainEvent(new AddUserIntegrationDomainEvent() + { + Name = user.Name + }); + await dbContext.Set().AddAsync(user); + await dbContext.SaveChangesAsync(); + var domainEventBus = _serviceProvider.GetRequiredService(); + var fields = domainEventBus.GetType().GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic).ToList(); + var field = fields.Where(field => field.Name == "_eventQueue").First(); + var eventQueue = (ConcurrentQueue)field.GetValue(domainEventBus)!; + Assert.IsTrue(eventQueue.Count == 1); + } +} diff --git a/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/DomainEvents/AddUserIntegrationDomainEvent.cs b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/DomainEvents/AddUserIntegrationDomainEvent.cs new file mode 100644 index 000000000..b03bfe363 --- /dev/null +++ b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/DomainEvents/AddUserIntegrationDomainEvent.cs @@ -0,0 +1,11 @@ +// Copyright (c) MASA Stack All rights reserved. +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +namespace Masa.Contrib.Ddd.Domain.Integrated.Tests.DomainEvents; + +public record AddUserIntegrationDomainEvent : IntegrationDomainEvent +{ + public string Name { get; set; } + + public override string Topic { get; set; } = nameof(AddUserIntegrationDomainEvent); +} diff --git a/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/Masa.Contrib.Ddd.Domain.Integrated.Tests.csproj b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/Masa.Contrib.Ddd.Domain.Integrated.Tests.csproj new file mode 100644 index 000000000..00b652076 --- /dev/null +++ b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/Masa.Contrib.Ddd.Domain.Integrated.Tests.csproj @@ -0,0 +1,35 @@ + + + + net6.0 + enable + false + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + diff --git a/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/_Imports.cs b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/_Imports.cs new file mode 100644 index 000000000..407f78784 --- /dev/null +++ b/test/Masa.Contrib.Ddd.Domain.Integrated.Tests/_Imports.cs @@ -0,0 +1,15 @@ +// Copyright (c) MASA Stack All rights reserved. +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +global using Masa.Contrib.Data.EntityFrameworkCore; +global using Masa.Contrib.Data.EntityFrameworkCore.Sqlite; +global using Masa.Contrib.Data.UoW.EF; +global using Masa.Contrib.Ddd.Domain.Events; +global using Masa.Contrib.Ddd.Domain.Repository.EF; +global using Masa.Contrib.Dispatcher.Events; +global using Masa.Contrib.Dispatcher.IntegrationEvents.Dapr; +global using Masa.Contrib.Dispatcher.IntegrationEvents.EventLogs.EF; +global using Microsoft.EntityFrameworkCore; +global using Microsoft.Extensions.DependencyInjection; +global using Microsoft.VisualStudio.TestTools.UnitTesting; +global using System; diff --git a/test/Masa.Contrib.Ddd.Domain.Tests/DomainEventBusTest.cs b/test/Masa.Contrib.Ddd.Domain.Tests/DomainEventBusTest.cs index 4dc1679db..9b1ffd24b 100644 --- a/test/Masa.Contrib.Ddd.Domain.Tests/DomainEventBusTest.cs +++ b/test/Masa.Contrib.Ddd.Domain.Tests/DomainEventBusTest.cs @@ -1,6 +1,8 @@ // Copyright (c) MASA Stack All rights reserved. // Licensed under the MIT License. See LICENSE.txt in the project root for license information. +using Masa.Contrib.Ddd.Domain.Entities.Tests; + namespace Masa.Contrib.Ddd.Domain.Tests; [TestClass] @@ -73,12 +75,12 @@ public async Task TestPublishDomainCommandAsync() _eventBus.Setup(eventBus => eventBus.PublishAsync(It.IsAny())) .Callback((domainEvent) => { - Mock> userRepository = new(); - var user = new Users() + Mock> userRepository = new(); + var user = new User() { Name = "Jim" }; - userRepository.Setup(repository => repository.AddAsync(It.IsAny(), CancellationToken.None)).Verifiable(); + userRepository.Setup(repository => repository.AddAsync(It.IsAny(), CancellationToken.None)).Verifiable(); domainEvent.UnitOfWork!.CommitAsync(); }); @@ -158,7 +160,7 @@ public void TestNotRepository() Assert.ThrowsException(() => { - services.AddDomainEventBus(new Assembly[1] { typeof(Users).Assembly }); + services.AddDomainEventBus(new Assembly[1] { typeof(User).Assembly }); }); } @@ -176,9 +178,9 @@ public void TestUserRepository() var integrationEventBus = new Mock(); services.AddScoped(_ => integrationEventBus.Object); - Mock> repository = new(); + Mock> repository = new(); services.AddScoped(_ => repository.Object); - services.AddDomainEventBus(new[] { typeof(Users).Assembly, typeof(DomainEventBusTest).Assembly }); + services.AddDomainEventBus(new[] { typeof(User).Assembly, typeof(DomainEventBusTest).Assembly }); } [TestMethod] diff --git a/test/Masa.Contrib.Ddd.Domain.Tests/Events/AddUserIntegrationDomainEvent.cs b/test/Masa.Contrib.Ddd.Domain.Tests/Events/AddUserIntegrationDomainEvent.cs new file mode 100644 index 000000000..caf173dec --- /dev/null +++ b/test/Masa.Contrib.Ddd.Domain.Tests/Events/AddUserIntegrationDomainEvent.cs @@ -0,0 +1,11 @@ +// Copyright (c) MASA Stack All rights reserved. +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +namespace Masa.Contrib.Ddd.Domain.Tests.Events; + +public record AddUserIntegrationDomainEvent : IntegrationDomainEvent +{ + public string Name { get; set; } + + public override string Topic { get; set; } = nameof(AddUserIntegrationDomainEvent); +} diff --git a/test/Masa.Contrib.Ddd.Domain.Tests/Masa.Contrib.Ddd.Domain.Tests.csproj b/test/Masa.Contrib.Ddd.Domain.Tests/Masa.Contrib.Ddd.Domain.Tests.csproj index 7f078a97a..fe10dfb4e 100644 --- a/test/Masa.Contrib.Ddd.Domain.Tests/Masa.Contrib.Ddd.Domain.Tests.csproj +++ b/test/Masa.Contrib.Ddd.Domain.Tests/Masa.Contrib.Ddd.Domain.Tests.csproj @@ -26,7 +26,7 @@ - + diff --git a/test/Masa.Contrib.Ddd.Domain.Tests/_Imports.cs b/test/Masa.Contrib.Ddd.Domain.Tests/_Imports.cs index 4617fe9da..e0805822b 100644 --- a/test/Masa.Contrib.Ddd.Domain.Tests/_Imports.cs +++ b/test/Masa.Contrib.Ddd.Domain.Tests/_Imports.cs @@ -9,7 +9,6 @@ global using Masa.Contrib.Ddd.Domain.Events; global using Masa.Contrib.Ddd.Domain.Tests.Events; global using Masa.Contrib.Ddd.Domain.Tests.Services; -global using Masa.Contribs.Ddd.Domain.Entities.Tests; global using Microsoft.Extensions.DependencyInjection; global using Microsoft.Extensions.Options; global using Microsoft.VisualStudio.TestTools.UnitTesting;