├── .gitattributes ├── .gitignore ├── Microservices.Tutorial.Outbox.Inbox.Design.Pattern.Example.sln ├── Order.API ├── Migrations │ ├── 20240112161626_mig_1.Designer.cs │ ├── 20240112161626_mig_1.cs │ ├── 20240113182740_mig_2.Designer.cs │ ├── 20240113182740_mig_2.cs │ ├── 20240113184329_mig_3.Designer.cs │ ├── 20240113184329_mig_3.cs │ ├── 20240117181921_mig_4.Designer.cs │ ├── 20240117181921_mig_4.cs │ └── OrderDbContextModelSnapshot.cs ├── Models │ ├── Contexts │ │ └── OrderDbContext.cs │ └── Entities │ │ ├── Order.cs │ │ ├── OrderItem.cs │ │ └── OrderOutbox.cs ├── Order.API.csproj ├── Program.cs ├── Properties │ └── launchSettings.json ├── ViewModels │ ├── CreateOrderItemVM.cs │ └── CreateOrderVM.cs ├── appsettings.Development.json └── appsettings.json ├── Order.Outbox.Table.Publisher.Service ├── Entities │ └── OrderOutbox.cs ├── Jobs │ └── OrderOutboxPublishJob.cs ├── Order.Outbox.Table.Publisher.Service.csproj ├── OrderOutboxSingletonDatabase.cs ├── Program.cs ├── Properties │ └── launchSettings.json ├── appsettings.Development.json └── appsettings.json ├── Shared ├── Datas │ └── OrderItem.cs ├── Events │ └── OrderCreatedEvent.cs ├── RabbitMQSettings.cs └── Shared.csproj └── Stock.Service ├── Consumers └── OrderCreatedEventConsumer.cs ├── Migrations ├── 20240114081922_mig_1.Designer.cs ├── 20240114081922_mig_1.cs ├── 20240117182441_mig_2.Designer.cs ├── 20240117182441_mig_2.cs └── StockDbContextModelSnapshot.cs ├── Models ├── Contexts │ └── StockDbContext.cs └── Entities │ └── OrderInbox.cs ├── Program.cs ├── Properties └── launchSettings.json ├── Stock.Service.csproj ├── appsettings.Development.json └── appsettings.json /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /Microservices.Tutorial.Outbox.Inbox.Design.Pattern.Example.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34310.174 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Order.API", "Order.API\Order.API.csproj", "{01C23AE6-E218-492E-A926-C6806B77DFAC}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stock.Service", "Stock.Service\Stock.Service.csproj", "{03755A6C-B62D-464D-8EB6-29ADFAC538B4}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "Shared\Shared.csproj", "{3516F012-67A3-4ADF-BB76-4659C07399B3}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Order.Outbox.Table.Publisher.Service", "Order.Outbox.Table.Publisher.Service\Order.Outbox.Table.Publisher.Service.csproj", "{257B1254-5AE3-45A2-8818-975226804483}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {01C23AE6-E218-492E-A926-C6806B77DFAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {01C23AE6-E218-492E-A926-C6806B77DFAC}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {01C23AE6-E218-492E-A926-C6806B77DFAC}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {01C23AE6-E218-492E-A926-C6806B77DFAC}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {03755A6C-B62D-464D-8EB6-29ADFAC538B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {03755A6C-B62D-464D-8EB6-29ADFAC538B4}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {03755A6C-B62D-464D-8EB6-29ADFAC538B4}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {03755A6C-B62D-464D-8EB6-29ADFAC538B4}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {3516F012-67A3-4ADF-BB76-4659C07399B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {3516F012-67A3-4ADF-BB76-4659C07399B3}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {3516F012-67A3-4ADF-BB76-4659C07399B3}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {3516F012-67A3-4ADF-BB76-4659C07399B3}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {257B1254-5AE3-45A2-8818-975226804483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {257B1254-5AE3-45A2-8818-975226804483}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {257B1254-5AE3-45A2-8818-975226804483}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {257B1254-5AE3-45A2-8818-975226804483}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {E65E3544-CEBF-4297-A87A-B93F3DC7E8C7} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240112161626_mig_1.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using Order.API.Models.Contexts; 9 | 10 | #nullable disable 11 | 12 | namespace Order.API.Migrations 13 | { 14 | [DbContext(typeof(OrderDbContext))] 15 | [Migration("20240112161626_mig_1")] 16 | partial class mig_1 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "8.0.1") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 25 | 26 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 29 | { 30 | b.Property("Id") 31 | .ValueGeneratedOnAdd() 32 | .HasColumnType("int"); 33 | 34 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 35 | 36 | b.Property("BuyerId") 37 | .HasColumnType("int"); 38 | 39 | b.Property("CreatedDate") 40 | .HasColumnType("datetime2"); 41 | 42 | b.Property("TotalPrice") 43 | .HasColumnType("decimal(18,2)"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.ToTable("Orders"); 48 | }); 49 | 50 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 51 | { 52 | b.Property("Id") 53 | .ValueGeneratedOnAdd() 54 | .HasColumnType("int"); 55 | 56 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 57 | 58 | b.Property("Count") 59 | .HasColumnType("int"); 60 | 61 | b.Property("OrderId") 62 | .HasColumnType("int"); 63 | 64 | b.Property("Price") 65 | .HasColumnType("decimal(18,2)"); 66 | 67 | b.Property("ProductId") 68 | .HasColumnType("int"); 69 | 70 | b.HasKey("Id"); 71 | 72 | b.HasIndex("OrderId"); 73 | 74 | b.ToTable("OrderItems"); 75 | }); 76 | 77 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 78 | { 79 | b.HasOne("Order.API.Models.Entities.Order", null) 80 | .WithMany("OrderItems") 81 | .HasForeignKey("OrderId"); 82 | }); 83 | 84 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 85 | { 86 | b.Navigation("OrderItems"); 87 | }); 88 | #pragma warning restore 612, 618 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240112161626_mig_1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace Order.API.Migrations 7 | { 8 | /// 9 | public partial class mig_1 : Migration 10 | { 11 | /// 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.CreateTable( 15 | name: "Orders", 16 | columns: table => new 17 | { 18 | Id = table.Column(type: "int", nullable: false) 19 | .Annotation("SqlServer:Identity", "1, 1"), 20 | BuyerId = table.Column(type: "int", nullable: false), 21 | CreatedDate = table.Column(type: "datetime2", nullable: false), 22 | TotalPrice = table.Column(type: "decimal(18,2)", nullable: false) 23 | }, 24 | constraints: table => 25 | { 26 | table.PrimaryKey("PK_Orders", x => x.Id); 27 | }); 28 | 29 | migrationBuilder.CreateTable( 30 | name: "OrderItems", 31 | columns: table => new 32 | { 33 | Id = table.Column(type: "int", nullable: false) 34 | .Annotation("SqlServer:Identity", "1, 1"), 35 | ProductId = table.Column(type: "int", nullable: false), 36 | Count = table.Column(type: "int", nullable: false), 37 | Price = table.Column(type: "decimal(18,2)", nullable: false), 38 | OrderId = table.Column(type: "int", nullable: true) 39 | }, 40 | constraints: table => 41 | { 42 | table.PrimaryKey("PK_OrderItems", x => x.Id); 43 | table.ForeignKey( 44 | name: "FK_OrderItems_Orders_OrderId", 45 | column: x => x.OrderId, 46 | principalTable: "Orders", 47 | principalColumn: "Id"); 48 | }); 49 | 50 | migrationBuilder.CreateIndex( 51 | name: "IX_OrderItems_OrderId", 52 | table: "OrderItems", 53 | column: "OrderId"); 54 | } 55 | 56 | /// 57 | protected override void Down(MigrationBuilder migrationBuilder) 58 | { 59 | migrationBuilder.DropTable( 60 | name: "OrderItems"); 61 | 62 | migrationBuilder.DropTable( 63 | name: "Orders"); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240113182740_mig_2.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using Order.API.Models.Contexts; 9 | 10 | #nullable disable 11 | 12 | namespace Order.API.Migrations 13 | { 14 | [DbContext(typeof(OrderDbContext))] 15 | [Migration("20240113182740_mig_2")] 16 | partial class mig_2 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "8.0.1") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 25 | 26 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 29 | { 30 | b.Property("Id") 31 | .ValueGeneratedOnAdd() 32 | .HasColumnType("int"); 33 | 34 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 35 | 36 | b.Property("BuyerId") 37 | .HasColumnType("int"); 38 | 39 | b.Property("CreatedDate") 40 | .HasColumnType("datetime2"); 41 | 42 | b.Property("TotalPrice") 43 | .HasColumnType("decimal(18,2)"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.ToTable("Orders"); 48 | }); 49 | 50 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 51 | { 52 | b.Property("Id") 53 | .ValueGeneratedOnAdd() 54 | .HasColumnType("int"); 55 | 56 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 57 | 58 | b.Property("Count") 59 | .HasColumnType("int"); 60 | 61 | b.Property("OrderId") 62 | .HasColumnType("int"); 63 | 64 | b.Property("Price") 65 | .HasColumnType("decimal(18,2)"); 66 | 67 | b.Property("ProductId") 68 | .HasColumnType("int"); 69 | 70 | b.HasKey("Id"); 71 | 72 | b.HasIndex("OrderId"); 73 | 74 | b.ToTable("OrderItems"); 75 | }); 76 | 77 | modelBuilder.Entity("Order.API.Models.Entities.OrderOutbox", b => 78 | { 79 | b.Property("OccuredOn") 80 | .HasColumnType("datetime2"); 81 | 82 | b.Property("Payload") 83 | .IsRequired() 84 | .HasColumnType("nvarchar(max)"); 85 | 86 | b.Property("ProcessedDate") 87 | .HasColumnType("datetime2"); 88 | 89 | b.Property("Type") 90 | .IsRequired() 91 | .HasColumnType("nvarchar(max)"); 92 | 93 | b.ToTable("OrderOutboxes"); 94 | }); 95 | 96 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 97 | { 98 | b.HasOne("Order.API.Models.Entities.Order", null) 99 | .WithMany("OrderItems") 100 | .HasForeignKey("OrderId"); 101 | }); 102 | 103 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 104 | { 105 | b.Navigation("OrderItems"); 106 | }); 107 | #pragma warning restore 612, 618 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240113182740_mig_2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace Order.API.Migrations 7 | { 8 | /// 9 | public partial class mig_2 : Migration 10 | { 11 | /// 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.CreateTable( 15 | name: "OrderOutboxes", 16 | columns: table => new 17 | { 18 | OccuredOn = table.Column(type: "datetime2", nullable: false), 19 | ProcessedDate = table.Column(type: "datetime2", nullable: true), 20 | Type = table.Column(type: "nvarchar(max)", nullable: false), 21 | Payload = table.Column(type: "nvarchar(max)", nullable: false) 22 | }, 23 | constraints: table => 24 | { 25 | }); 26 | } 27 | 28 | /// 29 | protected override void Down(MigrationBuilder migrationBuilder) 30 | { 31 | migrationBuilder.DropTable( 32 | name: "OrderOutboxes"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240113184329_mig_3.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using Order.API.Models.Contexts; 9 | 10 | #nullable disable 11 | 12 | namespace Order.API.Migrations 13 | { 14 | [DbContext(typeof(OrderDbContext))] 15 | [Migration("20240113184329_mig_3")] 16 | partial class mig_3 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "8.0.1") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 25 | 26 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 29 | { 30 | b.Property("Id") 31 | .ValueGeneratedOnAdd() 32 | .HasColumnType("int"); 33 | 34 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 35 | 36 | b.Property("BuyerId") 37 | .HasColumnType("int"); 38 | 39 | b.Property("CreatedDate") 40 | .HasColumnType("datetime2"); 41 | 42 | b.Property("TotalPrice") 43 | .HasColumnType("decimal(18,2)"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.ToTable("Orders"); 48 | }); 49 | 50 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 51 | { 52 | b.Property("Id") 53 | .ValueGeneratedOnAdd() 54 | .HasColumnType("int"); 55 | 56 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 57 | 58 | b.Property("Count") 59 | .HasColumnType("int"); 60 | 61 | b.Property("OrderId") 62 | .HasColumnType("int"); 63 | 64 | b.Property("Price") 65 | .HasColumnType("decimal(18,2)"); 66 | 67 | b.Property("ProductId") 68 | .HasColumnType("int"); 69 | 70 | b.HasKey("Id"); 71 | 72 | b.HasIndex("OrderId"); 73 | 74 | b.ToTable("OrderItems"); 75 | }); 76 | 77 | modelBuilder.Entity("Order.API.Models.Entities.OrderOutbox", b => 78 | { 79 | b.Property("Id") 80 | .ValueGeneratedOnAdd() 81 | .HasColumnType("int"); 82 | 83 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 84 | 85 | b.Property("OccuredOn") 86 | .HasColumnType("datetime2"); 87 | 88 | b.Property("Payload") 89 | .IsRequired() 90 | .HasColumnType("nvarchar(max)"); 91 | 92 | b.Property("ProcessedDate") 93 | .HasColumnType("datetime2"); 94 | 95 | b.Property("Type") 96 | .IsRequired() 97 | .HasColumnType("nvarchar(max)"); 98 | 99 | b.HasKey("Id"); 100 | 101 | b.ToTable("OrderOutboxes"); 102 | }); 103 | 104 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 105 | { 106 | b.HasOne("Order.API.Models.Entities.Order", null) 107 | .WithMany("OrderItems") 108 | .HasForeignKey("OrderId"); 109 | }); 110 | 111 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 112 | { 113 | b.Navigation("OrderItems"); 114 | }); 115 | #pragma warning restore 612, 618 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240113184329_mig_3.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Order.API.Migrations 6 | { 7 | /// 8 | public partial class mig_3 : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "Id", 15 | table: "OrderOutboxes", 16 | type: "int", 17 | nullable: false, 18 | defaultValue: 0) 19 | .Annotation("SqlServer:Identity", "1, 1"); 20 | 21 | migrationBuilder.AddPrimaryKey( 22 | name: "PK_OrderOutboxes", 23 | table: "OrderOutboxes", 24 | column: "Id"); 25 | } 26 | 27 | /// 28 | protected override void Down(MigrationBuilder migrationBuilder) 29 | { 30 | migrationBuilder.DropPrimaryKey( 31 | name: "PK_OrderOutboxes", 32 | table: "OrderOutboxes"); 33 | 34 | migrationBuilder.DropColumn( 35 | name: "Id", 36 | table: "OrderOutboxes"); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240117181921_mig_4.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using Order.API.Models.Contexts; 9 | 10 | #nullable disable 11 | 12 | namespace Order.API.Migrations 13 | { 14 | [DbContext(typeof(OrderDbContext))] 15 | [Migration("20240117181921_mig_4")] 16 | partial class mig_4 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "8.0.1") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 25 | 26 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 29 | { 30 | b.Property("Id") 31 | .ValueGeneratedOnAdd() 32 | .HasColumnType("int"); 33 | 34 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 35 | 36 | b.Property("BuyerId") 37 | .HasColumnType("int"); 38 | 39 | b.Property("CreatedDate") 40 | .HasColumnType("datetime2"); 41 | 42 | b.Property("TotalPrice") 43 | .HasColumnType("decimal(18,2)"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.ToTable("Orders"); 48 | }); 49 | 50 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 51 | { 52 | b.Property("Id") 53 | .ValueGeneratedOnAdd() 54 | .HasColumnType("int"); 55 | 56 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 57 | 58 | b.Property("Count") 59 | .HasColumnType("int"); 60 | 61 | b.Property("OrderId") 62 | .HasColumnType("int"); 63 | 64 | b.Property("Price") 65 | .HasColumnType("decimal(18,2)"); 66 | 67 | b.Property("ProductId") 68 | .HasColumnType("int"); 69 | 70 | b.HasKey("Id"); 71 | 72 | b.HasIndex("OrderId"); 73 | 74 | b.ToTable("OrderItems"); 75 | }); 76 | 77 | modelBuilder.Entity("Order.API.Models.Entities.OrderOutbox", b => 78 | { 79 | b.Property("IdempotentToken") 80 | .ValueGeneratedOnAdd() 81 | .HasColumnType("uniqueidentifier"); 82 | 83 | b.Property("OccuredOn") 84 | .HasColumnType("datetime2"); 85 | 86 | b.Property("Payload") 87 | .IsRequired() 88 | .HasColumnType("nvarchar(max)"); 89 | 90 | b.Property("ProcessedDate") 91 | .HasColumnType("datetime2"); 92 | 93 | b.Property("Type") 94 | .IsRequired() 95 | .HasColumnType("nvarchar(max)"); 96 | 97 | b.HasKey("IdempotentToken"); 98 | 99 | b.ToTable("OrderOutboxes"); 100 | }); 101 | 102 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 103 | { 104 | b.HasOne("Order.API.Models.Entities.Order", null) 105 | .WithMany("OrderItems") 106 | .HasForeignKey("OrderId"); 107 | }); 108 | 109 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 110 | { 111 | b.Navigation("OrderItems"); 112 | }); 113 | #pragma warning restore 612, 618 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /Order.API/Migrations/20240117181921_mig_4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace Order.API.Migrations 7 | { 8 | /// 9 | public partial class mig_4 : Migration 10 | { 11 | /// 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.DropPrimaryKey( 15 | name: "PK_OrderOutboxes", 16 | table: "OrderOutboxes"); 17 | 18 | migrationBuilder.DropColumn( 19 | name: "Id", 20 | table: "OrderOutboxes"); 21 | 22 | migrationBuilder.AddColumn( 23 | name: "IdempotentToken", 24 | table: "OrderOutboxes", 25 | type: "uniqueidentifier", 26 | nullable: false, 27 | defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); 28 | 29 | migrationBuilder.AddPrimaryKey( 30 | name: "PK_OrderOutboxes", 31 | table: "OrderOutboxes", 32 | column: "IdempotentToken"); 33 | } 34 | 35 | /// 36 | protected override void Down(MigrationBuilder migrationBuilder) 37 | { 38 | migrationBuilder.DropPrimaryKey( 39 | name: "PK_OrderOutboxes", 40 | table: "OrderOutboxes"); 41 | 42 | migrationBuilder.DropColumn( 43 | name: "IdempotentToken", 44 | table: "OrderOutboxes"); 45 | 46 | migrationBuilder.AddColumn( 47 | name: "Id", 48 | table: "OrderOutboxes", 49 | type: "int", 50 | nullable: false, 51 | defaultValue: 0) 52 | .Annotation("SqlServer:Identity", "1, 1"); 53 | 54 | migrationBuilder.AddPrimaryKey( 55 | name: "PK_OrderOutboxes", 56 | table: "OrderOutboxes", 57 | column: "Id"); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Order.API/Migrations/OrderDbContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 7 | using Order.API.Models.Contexts; 8 | 9 | #nullable disable 10 | 11 | namespace Order.API.Migrations 12 | { 13 | [DbContext(typeof(OrderDbContext))] 14 | partial class OrderDbContextModelSnapshot : ModelSnapshot 15 | { 16 | protected override void BuildModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "8.0.1") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 22 | 23 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 24 | 25 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 26 | { 27 | b.Property("Id") 28 | .ValueGeneratedOnAdd() 29 | .HasColumnType("int"); 30 | 31 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 32 | 33 | b.Property("BuyerId") 34 | .HasColumnType("int"); 35 | 36 | b.Property("CreatedDate") 37 | .HasColumnType("datetime2"); 38 | 39 | b.Property("TotalPrice") 40 | .HasColumnType("decimal(18,2)"); 41 | 42 | b.HasKey("Id"); 43 | 44 | b.ToTable("Orders"); 45 | }); 46 | 47 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 48 | { 49 | b.Property("Id") 50 | .ValueGeneratedOnAdd() 51 | .HasColumnType("int"); 52 | 53 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 54 | 55 | b.Property("Count") 56 | .HasColumnType("int"); 57 | 58 | b.Property("OrderId") 59 | .HasColumnType("int"); 60 | 61 | b.Property("Price") 62 | .HasColumnType("decimal(18,2)"); 63 | 64 | b.Property("ProductId") 65 | .HasColumnType("int"); 66 | 67 | b.HasKey("Id"); 68 | 69 | b.HasIndex("OrderId"); 70 | 71 | b.ToTable("OrderItems"); 72 | }); 73 | 74 | modelBuilder.Entity("Order.API.Models.Entities.OrderOutbox", b => 75 | { 76 | b.Property("IdempotentToken") 77 | .ValueGeneratedOnAdd() 78 | .HasColumnType("uniqueidentifier"); 79 | 80 | b.Property("OccuredOn") 81 | .HasColumnType("datetime2"); 82 | 83 | b.Property("Payload") 84 | .IsRequired() 85 | .HasColumnType("nvarchar(max)"); 86 | 87 | b.Property("ProcessedDate") 88 | .HasColumnType("datetime2"); 89 | 90 | b.Property("Type") 91 | .IsRequired() 92 | .HasColumnType("nvarchar(max)"); 93 | 94 | b.HasKey("IdempotentToken"); 95 | 96 | b.ToTable("OrderOutboxes"); 97 | }); 98 | 99 | modelBuilder.Entity("Order.API.Models.Entities.OrderItem", b => 100 | { 101 | b.HasOne("Order.API.Models.Entities.Order", null) 102 | .WithMany("OrderItems") 103 | .HasForeignKey("OrderId"); 104 | }); 105 | 106 | modelBuilder.Entity("Order.API.Models.Entities.Order", b => 107 | { 108 | b.Navigation("OrderItems"); 109 | }); 110 | #pragma warning restore 612, 618 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Order.API/Models/Contexts/OrderDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Order.API.Models.Entities; 3 | 4 | namespace Order.API.Models.Contexts 5 | { 6 | public class OrderDbContext : DbContext 7 | { 8 | public OrderDbContext(DbContextOptions options) : base(options) 9 | { 10 | } 11 | public DbSet Orders { get; set; } 12 | public DbSet OrderItems { get; set; } 13 | public DbSet OrderOutboxes { get; set; } 14 | 15 | protected override void OnModelCreating(ModelBuilder modelBuilder) 16 | { 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Order.API/Models/Entities/Order.cs: -------------------------------------------------------------------------------- 1 | namespace Order.API.Models.Entities 2 | { 3 | public class Order 4 | { 5 | public int Id { get; set; } 6 | public int BuyerId { get; set; } 7 | public DateTime CreatedDate { get; set; } 8 | public decimal TotalPrice { get; set; } 9 | 10 | public ICollection OrderItems { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Order.API/Models/Entities/OrderItem.cs: -------------------------------------------------------------------------------- 1 | namespace Order.API.Models.Entities 2 | { 3 | public class OrderItem 4 | { 5 | public int Id { get; set; } 6 | public int ProductId { get; set; } 7 | public int Count { get; set; } 8 | public decimal Price { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Order.API/Models/Entities/OrderOutbox.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Order.API.Models.Entities 4 | { 5 | public class OrderOutbox 6 | { 7 | [Key] 8 | public Guid IdempotentToken { get; set; } 9 | public DateTime OccuredOn { get; set; } 10 | public DateTime? ProcessedDate { get; set; } 11 | public string Type { get; set; } 12 | public string Payload { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Order.API/Order.API.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | all 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Order.API/Program.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gncyyldz/Microservices.Tutorial.Outbox.Inbox.Design.Pattern.Example/e2953c9f2ff462bd350452a7ffbf0016961c1c97/Order.API/Program.cs -------------------------------------------------------------------------------- /Order.API/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:2080", 8 | "sslPort": 44361 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "launchUrl": "swagger", 17 | "applicationUrl": "http://localhost:5226", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | }, 22 | "https": { 23 | "commandName": "Project", 24 | "dotnetRunMessages": true, 25 | "launchBrowser": true, 26 | "launchUrl": "swagger", 27 | "applicationUrl": "https://localhost:7244;http://localhost:5226", 28 | "environmentVariables": { 29 | "ASPNETCORE_ENVIRONMENT": "Development" 30 | } 31 | }, 32 | "IIS Express": { 33 | "commandName": "IISExpress", 34 | "launchBrowser": true, 35 | "launchUrl": "swagger", 36 | "environmentVariables": { 37 | "ASPNETCORE_ENVIRONMENT": "Development" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Order.API/ViewModels/CreateOrderItemVM.cs: -------------------------------------------------------------------------------- 1 | namespace Order.API.ViewModels 2 | { 3 | public class CreateOrderItemVM 4 | { 5 | public int ProductId { get; set; } 6 | public int Count { get; set; } 7 | public decimal Price { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.API/ViewModels/CreateOrderVM.cs: -------------------------------------------------------------------------------- 1 | namespace Order.API.ViewModels 2 | { 3 | public class CreateOrderVM 4 | { 5 | public int BuyerId { get; set; } 6 | public List OrderItems { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Order.API/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Order.API/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | "RabbitMQ": "amqps://iftpampy:16V0VschvHJvMk92AK0hcF_x_ADaOt2b@woodpecker.rmq.cloudamqp.com/iftpampy", 10 | "ConnectionStrings": { 11 | "MSSQLServer": "Server=localhost, 1433;Database=OrderDB;User ID=SA;Password=1q2w3e4r+!;TrustServerCertificate=True" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/Entities/OrderOutbox.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Outbox.Table.Publisher.Service.Entities 2 | { 3 | public class OrderOutbox 4 | { 5 | public Guid IdempotentToken { get; set; } 6 | public DateTime OccuredOn { get; set; } 7 | public DateTime? ProcessedDate { get; set; } 8 | public string Type { get; set; } 9 | public string Payload { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/Jobs/OrderOutboxPublishJob.cs: -------------------------------------------------------------------------------- 1 | using MassTransit; 2 | using Order.Outbox.Table.Publisher.Service.Entities; 3 | using Quartz; 4 | using Shared.Events; 5 | using System.Text.Json; 6 | 7 | namespace Order.Outbox.Table.Publisher.Service.Jobs 8 | { 9 | public class OrderOutboxPublishJob(IPublishEndpoint publishEndpoint) : IJob 10 | { 11 | public async Task Execute(IJobExecutionContext context) 12 | { 13 | if (OrderOutboxSingletonDatabase.DataReaderState) 14 | { 15 | OrderOutboxSingletonDatabase.DataReaderBusy(); 16 | 17 | List orderOutboxes = (await OrderOutboxSingletonDatabase.QueryAsync($@"SELECT * FROM ORDEROUTBOXES WHERE PROCESSEDDATE IS NULL ORDER BY OCCUREDON ASC")).ToList(); 18 | 19 | foreach (var orderOutbox in orderOutboxes) 20 | { 21 | if (orderOutbox.Type == nameof(OrderCreatedEvent)) 22 | { 23 | OrderCreatedEvent orderCreatedEvent = JsonSerializer.Deserialize(orderOutbox.Payload); 24 | if (orderCreatedEvent != null) 25 | { 26 | await publishEndpoint.Publish(orderCreatedEvent); 27 | OrderOutboxSingletonDatabase.ExecuteAsync($"UPDATE ORDEROUTBOXES SET PROCESSEDDATE = GETDATE() WHERE IdempotentToken = '{orderOutbox.IdempotentToken}'"); 28 | } 29 | } 30 | } 31 | 32 | OrderOutboxSingletonDatabase.DataReaderReady(); 33 | await Console.Out.WriteLineAsync("Order outbox table checked!"); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/Order.Outbox.Table.Publisher.Service.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | dotnet-Order.Outbox.Table.Publisher.Service-16a37cbd-6a75-4333-b2cc-b110efae383c 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/OrderOutboxSingletonDatabase.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using System.Data.SqlClient; 3 | using System.Data; 4 | 5 | namespace Order.Outbox.Table.Publisher.Service 6 | { 7 | public static class OrderOutboxSingletonDatabase 8 | { 9 | static IDbConnection _connection; 10 | static bool _dataReaderState = true; 11 | static OrderOutboxSingletonDatabase() 12 | => _connection = new SqlConnection("Server=localhost, 1433;Database=OrderDB;User ID=SA;Password=1q2w3e4r+!;TrustServerCertificate=True"); 13 | public static IDbConnection Connection 14 | { 15 | get 16 | { 17 | if (_connection.State == ConnectionState.Closed) 18 | _connection.Open(); 19 | return _connection; 20 | } 21 | } 22 | public static async Task> QueryAsync(string sql) 23 | => await _connection.QueryAsync(sql); 24 | public static async Task ExecuteAsync(string sql) 25 | => await _connection.ExecuteAsync(sql); 26 | public static void DataReaderReady() 27 | => _dataReaderState = true; 28 | public static void DataReaderBusy() 29 | => _dataReaderState = false; 30 | public static bool DataReaderState => _dataReaderState; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/Program.cs: -------------------------------------------------------------------------------- 1 | using MassTransit; 2 | using Order.Outbox.Table.Publisher.Service.Jobs; 3 | using Quartz; 4 | 5 | var builder = Host.CreateApplicationBuilder(args); 6 | 7 | builder.Services.AddMassTransit(configurator => 8 | { 9 | configurator.UsingRabbitMq((context, _configure) => 10 | { 11 | _configure.Host(builder.Configuration["RabbitMQ"]); 12 | }); 13 | }); 14 | 15 | builder.Services.AddQuartz(configurator => 16 | { 17 | JobKey jobKey = new("OrderOutboxPublishJob"); 18 | configurator.AddJob(options => options.WithIdentity(jobKey)); 19 | 20 | TriggerKey triggerKey = new("OrderOutboxPublishTrigger"); 21 | configurator.AddTrigger(options => options.ForJob(jobKey) 22 | .WithIdentity(triggerKey) 23 | .StartAt(DateTime.UtcNow) 24 | .WithSimpleSchedule(builder => builder 25 | .WithIntervalInSeconds(5) 26 | .RepeatForever())); 27 | }); 28 | 29 | builder.Services.AddQuartzHostedService(options => options.WaitForJobsToComplete = true); 30 | 31 | var host = builder.Build(); 32 | host.Run(); 33 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "Order.Outbox.Table.Publisher.Service": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "environmentVariables": { 8 | "DOTNET_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Order.Outbox.Table.Publisher.Service/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | }, 8 | "RabbitMQ": "amqps://iftpampy:16V0VschvHJvMk92AK0hcF_x_ADaOt2b@woodpecker.rmq.cloudamqp.com/iftpampy", 9 | "ConnectionStrings": { 10 | "MSSQLServer": "Server=localhost, 1433;Database=OrderDB;User ID=SA;Password=1q2w3e4r+!;TrustServerCertificate=True" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Shared/Datas/OrderItem.cs: -------------------------------------------------------------------------------- 1 | namespace Shared.Datas 2 | { 3 | public class OrderItem 4 | { 5 | public int ProductId { get; set; } 6 | public int Count { get; set; } 7 | public decimal Price { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Shared/Events/OrderCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Shared.Datas; 2 | namespace Shared.Events 3 | { 4 | public class OrderCreatedEvent 5 | { 6 | public int OrderId { get; set; } 7 | public int BuyerId { get; set; } 8 | public decimal TotalPrice { get; set; } 9 | public List OrderItems { get; set; } 10 | public Guid IdempotentToken { get; set; } 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Shared/RabbitMQSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Shared 8 | { 9 | public static class RabbitMQSettings 10 | { 11 | public const string Stock_OrderCreatedEvent = "stock-order-created-event"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Shared/Shared.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Stock.Service/Consumers/OrderCreatedEventConsumer.cs: -------------------------------------------------------------------------------- 1 | using MassTransit; 2 | using Microsoft.EntityFrameworkCore; 3 | using Shared.Events; 4 | using Stock.Service.Models.Contexts; 5 | using Stock.Service.Models.Entities; 6 | using System.Text.Json; 7 | 8 | namespace Stock.Service.Consumers 9 | { 10 | public class OrderCreatedEventConsumer(StockDbContext stockDbContext) : IConsumer 11 | { 12 | public async Task Consume(ConsumeContext context) 13 | { 14 | var result = await stockDbContext.OrderInboxes.AnyAsync(i => i.IdempotentToken == context.Message.IdempotentToken); 15 | if (!result) 16 | { 17 | 18 | await stockDbContext.OrderInboxes.AddAsync(new() 19 | { 20 | Processed = false, 21 | Payload = JsonSerializer.Serialize(context.Message), 22 | IdempotentToken = context.Message.IdempotentToken 23 | }); 24 | 25 | await stockDbContext.SaveChangesAsync(); 26 | } 27 | 28 | 29 | List orderInboxes = await stockDbContext.OrderInboxes 30 | .Where(i => i.Processed == false) 31 | .ToListAsync(); 32 | foreach (var orderInbox in orderInboxes) 33 | { 34 | OrderCreatedEvent orderCreatedEvent = JsonSerializer.Deserialize(orderInbox.Payload); 35 | Console.WriteLine($"{orderCreatedEvent.OrderId} order id değerine karşılık olan siparişin stok işlemleri başarıyla tamamlanmıştır."); 36 | orderInbox.Processed = true; 37 | await stockDbContext.SaveChangesAsync(); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Stock.Service/Migrations/20240114081922_mig_1.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Infrastructure; 4 | using Microsoft.EntityFrameworkCore.Metadata; 5 | using Microsoft.EntityFrameworkCore.Migrations; 6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 7 | using Stock.Service.Models.Contexts; 8 | 9 | #nullable disable 10 | 11 | namespace Stock.Service.Migrations 12 | { 13 | [DbContext(typeof(StockDbContext))] 14 | [Migration("20240114081922_mig_1")] 15 | partial class mig_1 16 | { 17 | /// 18 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 19 | { 20 | #pragma warning disable 612, 618 21 | modelBuilder 22 | .HasAnnotation("ProductVersion", "8.0.1") 23 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 24 | 25 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 26 | 27 | modelBuilder.Entity("Stock.Service.Models.Entities.OrderInbox", b => 28 | { 29 | b.Property("Id") 30 | .ValueGeneratedOnAdd() 31 | .HasColumnType("int"); 32 | 33 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); 34 | 35 | b.Property("Payload") 36 | .IsRequired() 37 | .HasColumnType("nvarchar(max)"); 38 | 39 | b.Property("Processed") 40 | .HasColumnType("bit"); 41 | 42 | b.HasKey("Id"); 43 | 44 | b.ToTable("OrderInboxes"); 45 | }); 46 | #pragma warning restore 612, 618 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Stock.Service/Migrations/20240114081922_mig_1.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Stock.Service.Migrations 6 | { 7 | /// 8 | public partial class mig_1 : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.CreateTable( 14 | name: "OrderInboxes", 15 | columns: table => new 16 | { 17 | Id = table.Column(type: "int", nullable: false) 18 | .Annotation("SqlServer:Identity", "1, 1"), 19 | Processed = table.Column(type: "bit", nullable: false), 20 | Payload = table.Column(type: "nvarchar(max)", nullable: false) 21 | }, 22 | constraints: table => 23 | { 24 | table.PrimaryKey("PK_OrderInboxes", x => x.Id); 25 | }); 26 | } 27 | 28 | /// 29 | protected override void Down(MigrationBuilder migrationBuilder) 30 | { 31 | migrationBuilder.DropTable( 32 | name: "OrderInboxes"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Stock.Service/Migrations/20240117182441_mig_2.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using Stock.Service.Models.Contexts; 9 | 10 | #nullable disable 11 | 12 | namespace Stock.Service.Migrations 13 | { 14 | [DbContext(typeof(StockDbContext))] 15 | [Migration("20240117182441_mig_2")] 16 | partial class mig_2 17 | { 18 | /// 19 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 20 | { 21 | #pragma warning disable 612, 618 22 | modelBuilder 23 | .HasAnnotation("ProductVersion", "8.0.1") 24 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 25 | 26 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 27 | 28 | modelBuilder.Entity("Stock.Service.Models.Entities.OrderInbox", b => 29 | { 30 | b.Property("IdempotentToken") 31 | .ValueGeneratedOnAdd() 32 | .HasColumnType("uniqueidentifier"); 33 | 34 | b.Property("Payload") 35 | .IsRequired() 36 | .HasColumnType("nvarchar(max)"); 37 | 38 | b.Property("Processed") 39 | .HasColumnType("bit"); 40 | 41 | b.HasKey("IdempotentToken"); 42 | 43 | b.ToTable("OrderInboxes"); 44 | }); 45 | #pragma warning restore 612, 618 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Stock.Service/Migrations/20240117182441_mig_2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace Stock.Service.Migrations 7 | { 8 | /// 9 | public partial class mig_2 : Migration 10 | { 11 | /// 12 | protected override void Up(MigrationBuilder migrationBuilder) 13 | { 14 | migrationBuilder.DropPrimaryKey( 15 | name: "PK_OrderInboxes", 16 | table: "OrderInboxes"); 17 | 18 | migrationBuilder.DropColumn( 19 | name: "Id", 20 | table: "OrderInboxes"); 21 | 22 | migrationBuilder.AddColumn( 23 | name: "IdempotentToken", 24 | table: "OrderInboxes", 25 | type: "uniqueidentifier", 26 | nullable: false, 27 | defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); 28 | 29 | migrationBuilder.AddPrimaryKey( 30 | name: "PK_OrderInboxes", 31 | table: "OrderInboxes", 32 | column: "IdempotentToken"); 33 | } 34 | 35 | /// 36 | protected override void Down(MigrationBuilder migrationBuilder) 37 | { 38 | migrationBuilder.DropPrimaryKey( 39 | name: "PK_OrderInboxes", 40 | table: "OrderInboxes"); 41 | 42 | migrationBuilder.DropColumn( 43 | name: "IdempotentToken", 44 | table: "OrderInboxes"); 45 | 46 | migrationBuilder.AddColumn( 47 | name: "Id", 48 | table: "OrderInboxes", 49 | type: "int", 50 | nullable: false, 51 | defaultValue: 0) 52 | .Annotation("SqlServer:Identity", "1, 1"); 53 | 54 | migrationBuilder.AddPrimaryKey( 55 | name: "PK_OrderInboxes", 56 | table: "OrderInboxes", 57 | column: "Id"); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Stock.Service/Migrations/StockDbContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 7 | using Stock.Service.Models.Contexts; 8 | 9 | #nullable disable 10 | 11 | namespace Stock.Service.Migrations 12 | { 13 | [DbContext(typeof(StockDbContext))] 14 | partial class StockDbContextModelSnapshot : ModelSnapshot 15 | { 16 | protected override void BuildModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "8.0.1") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 22 | 23 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 24 | 25 | modelBuilder.Entity("Stock.Service.Models.Entities.OrderInbox", b => 26 | { 27 | b.Property("IdempotentToken") 28 | .ValueGeneratedOnAdd() 29 | .HasColumnType("uniqueidentifier"); 30 | 31 | b.Property("Payload") 32 | .IsRequired() 33 | .HasColumnType("nvarchar(max)"); 34 | 35 | b.Property("Processed") 36 | .HasColumnType("bit"); 37 | 38 | b.HasKey("IdempotentToken"); 39 | 40 | b.ToTable("OrderInboxes"); 41 | }); 42 | #pragma warning restore 612, 618 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Stock.Service/Models/Contexts/StockDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Stock.Service.Models.Entities; 3 | 4 | namespace Stock.Service.Models.Contexts 5 | { 6 | public class StockDbContext : DbContext 7 | { 8 | public StockDbContext(DbContextOptions options) : base(options) 9 | { 10 | } 11 | 12 | public DbSet OrderInboxes { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Stock.Service/Models/Entities/OrderInbox.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Stock.Service.Models.Entities 4 | { 5 | public class OrderInbox 6 | { 7 | [Key] 8 | public Guid IdempotentToken { get; set; } 9 | public bool Processed { get; set; } 10 | public string Payload { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Stock.Service/Program.cs: -------------------------------------------------------------------------------- 1 | using MassTransit; 2 | using Microsoft.EntityFrameworkCore; 3 | using Shared; 4 | using Stock.Service.Consumers; 5 | using Stock.Service.Models.Contexts; 6 | 7 | var builder = Host.CreateApplicationBuilder(args); 8 | 9 | builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("MSSQLServer"))); 10 | 11 | builder.Services.AddMassTransit(configurator => 12 | { 13 | configurator.AddConsumer(); 14 | configurator.UsingRabbitMq((context, _configure) => 15 | { 16 | _configure.Host(builder.Configuration["RabbitMQ"]); 17 | 18 | _configure.ReceiveEndpoint(RabbitMQSettings.Stock_OrderCreatedEvent, e => e.ConfigureConsumer(context)); 19 | }); 20 | }); 21 | var host = builder.Build(); 22 | host.Run(); 23 | -------------------------------------------------------------------------------- /Stock.Service/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "Stock.Service": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "environmentVariables": { 8 | "DOTNET_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Stock.Service/Stock.Service.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | dotnet-Stock.Service-63b6e93a-ab97-4b3e-be8a-a229ed5ef83f 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | all 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Stock.Service/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Stock.Service/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | }, 8 | "RabbitMQ": "amqps://iftpampy:16V0VschvHJvMk92AK0hcF_x_ADaOt2b@woodpecker.rmq.cloudamqp.com/iftpampy", 9 | "ConnectionStrings": { 10 | "MSSQLServer": "Server=localhost, 1433;Database=StockDB;User ID=SA;Password=1q2w3e4r+!;TrustServerCertificate=True" 11 | } 12 | } 13 | --------------------------------------------------------------------------------