How to: Add the Scheduler Module (.NET)
- 3 minutes to read
This article describes how to add the Scheduler module to .NET Windows Forms and ASP.NET Core Blazor applications.
The module implements a calendar component for scheduling appointments and events.
#Step-by-Step Instructions
Add the DevExpress.ExpressApp.Scheduler NuGet package to the MySolution.Module project. See the following topic for more information on how to install DevExpress NuGet packages: Choose Between Offline and Online DevExpress NuGet Feeds.
In the Solution Explorer, go to the MySolution.Module project and open the Module.cs file. Add the Scheduler module to the RequiredModuleTypes collection. Then, add the
Event
andResource
classes to the AdditionalExportedTypes collection.In Entity Framework Core-based applications:
C#//... namespace MySolution.Module; //... public sealed class MySolutionModule : ModuleBase { public MySolutionModule() { //... RequiredModuleTypes.Add(typeof(DevExpress.ExpressApp.Scheduler.SchedulerModuleBase)); AdditionalExportedTypes.Add(typeof(DevExpress.Persistent.BaseImpl.EF.Event)); AdditionalExportedTypes.Add(typeof(DevExpress.Persistent.BaseImpl.EF.Resource)); } //... }
In XPO-based applications:
C#//... namespace MySolution.Module; //... public sealed class MySolutionModule : ModuleBase { public MySolutionModule() { //... RequiredModuleTypes.Add(typeof(DevExpress.ExpressApp.Scheduler.SchedulerModuleBase)); AdditionalExportedTypes.Add(typeof(DevExpress.Persistent.BaseImpl.Event)); AdditionalExportedTypes.Add(typeof(DevExpress.Persistent.BaseImpl.Resource)); } //... }
Optional. If you use Entity Framework Core, go to the MySolution.Module\BusinessObjects folder, open the MySolutionDbContext.cs file. Then, register the
Event
andResource
types in the application’sDbContext
:C#namespace MyApplication.Module.BusinessObjects; //.. public class MySolutionDbContext : DbContext { // .. public DbSet<Event> Events { get; set; } public DbSet<Resource> Resources { get; set; } }
Note
Unlike native EF Core, XAF automatically updates database schema when the structure of business objects changes. However, you can use EF Core migrations to update database schema manually. Refer to the following help topic for additional information: Update Database Schema and Migrations in EF Core.
Add the following NuGet packages to platform-specific projects in your application:
- MySolution.Blazor.Server project: DevExpress.ExpressApp.Scheduler.Blazor
- MySolution.Win project: DevExpress.ExpressApp.Scheduler.Win
In ASP.NET Core Blazor application, navigate to the MySolution.Blazor.Server\Startup.cs file and call the AddScheduler(IModuleBuilder<IBlazorApplicationBuilder>, Action<SchedulerOptions>) method.
In Windows Forms application, navigate to the MySolution.Win\Startup.cs file and call the AddScheduler(IModuleBuilder<IWinApplicationBuilder>, Action<SchedulerOptions>) method.
public class Startup { // ... public void ConfigureServices(IServiceCollection services) { // ... services.AddXaf(Configuration, builder => { builder.UseApplication<MySolutionBlazorApplication>(); builder.Modules // ... .AddScheduler(); // ... }); // ... } }
Build the project and run the application. The Scheduler Event item appears in the navigation control.
- ASP.NET Core Blazor
- Windows Forms
Tip
XAF has a special Notifications module you can use to set notifications for events. For more information about this module, refer to the following topic: How to: Use Notifications with the Scheduler Event.