Back to Devexpress

WebApiOptions.BusinessObject(Type) Method

expressappframework-devexpress-dot-expressapp-dot-webapi-dot-services-dot-webapioptions-dot-businessobject-x28-system-dot-type-x29.md

latest2.5 KB
Original Source

WebApiOptions.BusinessObject(Type) Method

Generates HTTP endpoints for a type passed as a parameter.

Namespace : DevExpress.ExpressApp.WebApi.Services

Assembly : DevExpress.ExpressApp.WebApi.v25.2.dll

NuGet Package : DevExpress.ExpressApp.WebApi

Declaration

csharp
public void BusinessObject(
    Type objectType
)
vb
Public Sub BusinessObject(
    objectType As Type
)

Parameters

NameTypeDescription
objectTypeType

A type for which the Web API Service generates HTTP endpoints.

|

Remarks

The following code creates endpoints for the type of the user instance:

File: MySolution.WebApi\Startup.cs (MySolution.Blazor.Server\Startup.cs)

csharp
using MySolution.Module.BusinessObjects;
namespace MySolution.WebApi {
    public class Startup {
        public Startup(IConfiguration configuration) {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // ...
        public void ConfigureServices(IServiceCollection services) {
            // ...
            services.AddXafWebApi(Configuration, options => {
                options.BusinessObject<ApplicationUser>();
                options.BusinessObject<Contact>();
            })
            // in XPO applications, uncomment the following line
            // .AddXpoServices();
            // ...
        }
        // ...
    }
}

See Also

Backend Web API Service / REST API

Add and Protect CRUD Web API Endpoints

WebApiOptions Class

WebApiOptions Members

DevExpress.ExpressApp.WebApi.Services Namespace