Relatude.DB.Ecom
1.0.21
dotnet add package Relatude.DB.Ecom --version 1.0.21
NuGet\Install-Package Relatude.DB.Ecom -Version 1.0.21
<PackageReference Include="Relatude.DB.Ecom" Version="1.0.21" />
<PackageVersion Include="Relatude.DB.Ecom" Version="1.0.21" />
<PackageReference Include="Relatude.DB.Ecom" />
paket add Relatude.DB.Ecom --version 1.0.21
#r "nuget: Relatude.DB.Ecom, 1.0.21"
#:package Relatude.DB.Ecom@1.0.21
#addin nuget:?package=Relatude.DB.Ecom&version=1.0.21
#tool nuget:?package=Relatude.DB.Ecom&version=1.0.21
Relatude.Ecom
A .NET 8 e-commerce backend layered on Relatude.CMS (package dependency), which in turn runs on the Relatude.DB node/graph database. Adds the commerce model (products, orders, carts), pricing, and pluggable providers (payment, shipping, tax, …).
Using an AI coding agent? This package ships a Claude Code skill (
relatude-ecom) with the same guidance below. Read theRelatude.CMSdocs (relatude-cmsskill) first — it covers the shared Relatude.DB fundamentals (host setup,NodeStore, modeling interfaces, relations, CRUD, queries) that this layer assumes.Relatude.CMSis pulled in transitively, so its docs travel alongside this package.
Commerce model
Entities are interfaces, like in CMS. Products extend the CMS content model so they are routable pages:
public interface IProduct : IItem, IPage {
decimal Price { get; set; }
int NumberInStock { get; set; }
ProductCategoryProducts.Category Category { get; set; } // one-end → category
ProductVariants.SubVariants Variants { get; set; } // many-end → variant products
[EmbeddedMapProperty(KeyProperty = nameof(IAlternativeCurrencyPrice.CurrencyCode))]
EmbeddedMap<string, IAlternativeCurrencyPrice> AlternativePrices { get; }
}
Core entities: IShop, IProduct, IProductCategory, IProductBundle, ISimpleVariant, IBrand, IOrder, IOrderItem, IEcomUser, ICurrency, IEcomCountry, IPaymentMethod, IShippingMethod, ITaxClass, ITaxRate, ISalesChannel, IDiscount. Relations live in Models/EcomRelations.cs, declared with the same OneToMany/ManyToMany marker-class pattern as CMS.
Carts (ShoppingCartService)
A cart is an IOrder with OrderStatus.Basket — there is no separate cart type; checkout advances the order's status. ShoppingCartService resolves the cart from IEcomUser.Orders for authenticated users (looked up via the ClaimTypes.NameIdentifier claim) or from a cookie (EcomSettings.CartCookieName, default ecom.cart) holding the order Guid for anonymous users. Every method takes NodeStore db. Items are managed via SetRelation/ClearRelation on IOrder.OrderItems; re-adding a product increments Quantity instead of duplicating. Settings come from IOptions<EcomSettings> (config section "Ecom").
Pricing (DefaultPricingService)
DefaultPricingService : IPricingService composes four injected collaborators — IPriceResolver (base price), IProductDiscountProvider, IOrderDiscountProvider, and ITaxCalculationProvider (VAT). A PricingContext flows through every calculation; it requires Shop and CurrencyCode and carries the NodeStore. Amounts are computed ex-VAT first, then VAT applied, rounded via CurrencyUtils.Round. CalculateProductVariantPrices prices the product plus its Variants. (CalculateOrderPrice is currently not implemented.)
Providers (Providers/...)
Each pluggable concern is an IXxxProvider interface with a Default* implementation: Currency, Discounts, Inventory, Notification, Payment, Shipping, Tax. Multi-implementation concerns (Payment, Shipping) resolve a concrete provider by a string ProviderKey via a factory over IEnumerable<IXxxProvider>:
services.AddScoped<IPaymentProvider, StripePaymentProvider>(); // each exposes ProviderKey
services.AddScoped<IPaymentProvider, NetsPaymentProvider>();
services.AddScoped<IPaymentProviderFactory, PaymentProviderFactory>();
// at runtime:
var provider = factory.GetProvider(paymentMethod.ProviderKey); // throws on unknown key
The order/payment-method node stores which ProviderKey to use. This library supplies the contracts and Default* implementations; the host registers concrete third-party providers and wires the rest in DI.
Notes
- A cart is just an
IOrderinBasketstatus — there is no dedicated cart entity. CalculateOrderPriceis not implemented yet.PricingContextwithoutShop/CurrencyCodethrows — always set both.- All Relatude.DB rules from
Relatude.CMSapply (Createdoesn't persist, relation ends aren't lists, mutate-then-Update, …). - Relatude.DB source/API reference: https://github.com/Relatude/Relatude.DB
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Http (>= 2.3.10)
- Relatude.DB.CMS (>= 1.0.21)
- Relatude.DB.Server (>= 0.2.0.109-alpha)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.