Watching
Please find this dedicated tutorial video on YouTube about how to adjust basic options with Apizr:
Configuring base address
You can configure base address and base path either by attribute decoration or by fluent configuration. Fluent configuration allows you to load options automatically from settings (see Settings), or set options manually. You can mix the configuration providing a base path by attribute and a base address/URI fluently.
BaseAddress
attribute
You can set api interface or CRUD entity base address or path thanks to the BaseAddress
attribute. It let you set the base address at design time and then register your api fluently without having to set it.
You can do it like so:
[BaseAddress("YOUR_API_INTERFACE_BASE_ADDRESS_OR_PATH")]
public interface IYourApiInterface
{
// Your api interface methods
}
// OR the same for CRUD api
[BaseAddress("YOUR_CRUD_ENTITY_API_BASE_ADDRESS_OR_PATH")]
public record YourCrudEntity
{
// Your CRUD entity properties
}
Note that if you provided only a path, you still have to set the base address/URI fluently at registration time so that Apizr could merge it all together.
AutoRegister
attribute
You can set api interface or CRUD entity base address or path thanks to the AutoRegister
attribute. It let you set the base address at design time and then register apis by assembly scanning at register time.
You can do it like so:
[AutoRegister("YOUR_API_INTERFACE_BASE_ADDRESS_OR_PATH")]
public interface IYourApiInterface
{
// Your api interface methods
}
// OR the same for CRUD api
[AutoRegister("YOUR_CRUD_ENTITY_API_BASE_ADDRESS_OR_PATH")]
public record YourCrudEntity
{
// Your CRUD entity properties
}
Note that if you provided only a path, you still have to set the base address/URI fluently at registration time so that Apizr could merge it all together.
AutoRegister
attribute comes with more options so you should read more about it from the Getting Started doc articles.