Update a Receiver contract
A Graft contract is the exposed callable surface plus its type information. Changing it can require a new generated package and coordinated Caller changes. Use a deliberate workflow rather than assuming old Callers keep working.
Classify the change
- Additive change — adding a new method or a new optional field. Existing Callers can keep using the old Graft; new Callers adopt the new version when ready.
- Breaking change — renaming or removing a method, changing a signature, or changing a type in a way that changes the generated public API. Existing Callers must upgrade.
See Contract evolution for how surface changes map to the generated public API.
Additive change example
Add a new method without touching existing ones. Rebuild, host, and publish a new package version. Existing Callers are unaffected until they choose to upgrade.
// Existing: Calculate(...). New, additive:public decimal CalculateWithTax(decimal basePrice, decimal discountPercent, decimal taxPercent) { /* ... */ }
Changing a signature (for example, adding a required parameter or changing a return type) is breaking. Publish it as a new package version and require Callers to upgrade before you retire the old one.
Rollout workflow
- Make the surface change and rebuild, then host with Gateway:
dotnet build ./Pricing/Pricing.csprojgg ./Pricing/bin/Debug/net9.0/Pricing.dll --types Pricing.PriceService --methods Calculate
Old Callers using an older Graft
An old Caller keeps calling with the contract baked into its installed Graft version. It does not automatically pick up surface changes. Compatibility depends on:
- Product/protocol compatibility — whether the Gateway and runtime versions still interoperate.
- Receiver contract compatibility — whether the Receiver still accepts the old contract's calls.
Do not assume old Grafts remain compatible across releases. Pin versions and validate.
See Version compatibility and upgrades and Handle Receiver errors.