/eShopOnWeb

A fork of the eShopOnWeb ASP.NET Core Reference Application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model

Primary LanguageC#MIT LicenseMIT

My eShopOnWeb [WIP]

This is a fork of the eShopOnWeb ASP.NET Core Reference Application, you can read the original README here

Stock management

-- Update/Fix Catalog Stock Reserved Quantity
MERGE dbo.CatalogStock as tgt
USING (
	SELECT ItemOrdered_CatalogItemId AS CatalogItemId, sum(Units)
	from dbo.OrderItems 
	group by ItemOrdered_CatalogItemId
) as src (CatalogItemId, Units)
ON tgt.Id = src.CatalogItemId
WHEN MATCHED THEN  
	UPDATE SET ReservedQuantity = src.Units
WHEN NOT MATCHED BY TARGET THEN  
	INSERT (Id, StockQuantity, ReservedQuantity) VALUES (src.CatalogItemId, 0, src.Units);
  
select *
from [dbo].[CatalogStock]

-- Check Stock
select *
from (
	SELECT ItemOrdered_CatalogItemId AS CatalogItemId, sum(Units) as OrderedQuantity
	from dbo.OrderItems 
	group by ItemOrdered_CatalogItemId
) as qOrdered
FULL OUTER JOIN dbo.CatalogStock as qStock ON qStock.Id = qOrdered.CatalogItemId
where qOrdered.CatalogItemId is NULL or qStock.Id is NULL or qOrdered.OrderedQuantity <> qStock.ReservedQuantity

Azure functions (isolated)

ServiceBus send messages quota exceeded

Sending Messages at Scale - Cannot allocate more handles | The Long Walk

Best practices for improving performance using Azure Service Bus - Azure Service Bus | Microsoft Learn