mirror of https://github.com/EasyAbp/EShop.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.9 KiB
2.9 KiB
EShop.Plugins.Inventories.OrleansGrains
EShop product-inventory implementation of Orleans Grains.
Installation
-
Install the following NuGet packages. (see how)
- EasyAbp.EShop.Products.OrleansGrainsInventory.Domain (install at EasyAbp.EShop.Products.Domain location)
- EasyAbp.EShop.Plugins.Inventories.OrleansGrains.Silo (install at a host project to run Grains)
-
Add
DependsOn(typeof(EShopXxxModule))attribute to configure the module dependencies. (see how) -
Open
Program.csin the host project to create an Orleans Silo. (see Microsoft's document for more information)builder.Host.AddAppSettingsSecretsJson() .UseAutofac() .UseSerilog() .UseOrleans(c => { c.UseLocalhostClustering() // for test only c.AddMemoryGrainStorage(InventoryGrain.StorageProviderName); // for test only });
Usage
-
Configure the OrleansGrains inventory provider as default.
Configure<EShopProductsOptions>(options => { // Configure as the default inventory provider options.DefaultInventoryProviderName = "OrleansGrains"; // Configure as the default inventory provider for MyProductGroup options.Groups.Configure<MyProductGroup>(group => { group.DefaultInventoryProviderName = "OrleansGrains"; }); });Better to use
OrleansGrainsProductInventoryProvider.OrleansGrainsProductInventoryProviderNameinstead of"OrleansGrains"as the provider name. -
Create a product and set
InventoryProviderNametoOrleansGrains. Then the product is specified to use the Orleans Grains inventory provider.