Part of DKNet.EfCore.Abstractions. Declare which constructors and methods SlimBus.Generators can turn into request handlers and endpoints.
Use the console-project setup in the Quick Start, then replace Program.cs with this example.
using DKNet.EfCore.Abstractions.Attributes;
Console.WriteLine(new CrudActionAttribute().Verb); // Post
public sealed class Order
{
[CrudCreate]
public Order(string customer) => Customer = customer;
public string Customer { get; private set; }
[CrudUpdate]
public void Rename(string customer) => Customer = customer;
[CrudAction("approve", Verb = CrudActionVerb.Patch, Name = "ApproveOrder")]
public void Approve() { }
}
These declarations are inert without SlimBus.Generators. Keep domain methods as the source of business behavior; the generator owns the transport adapter.
| Marker | Targets | Option | Default | Effect |
|---|---|---|---|---|
CrudCreate |
Constructor, Method | Name |
null |
Override generated Create request name. |
CrudUpdate |
Method | Name |
null |
Override generated Update request name. |
CrudAction |
Method | route |
null |
Use generator-derived kebab-case method route. |
CrudAction |
Method | Verb |
Post |
Select Post, Put or Patch. |
CrudAction |
Method | Name |
null |
Override generated action request name. |
The domain references only the marker types here. SlimBus.Generators consumes those markers during compilation; generated adapters execute the domain methods in the API host.
CrudActionVerb has no Delete value.[CrudUpdate] and [CrudAction] on one member. Consult the generator guide for supported signatures and diagnostics.