Skip to main content
All docs
V24.1
.NET Framework 4.5.2+

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

  1. 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.

  2. 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 and Resource classes to the AdditionalExportedTypes collection.

    In Entity Framework Core-based applications:

    //...
    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:

    //...
    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));
        }
    //...
    }
    
  3. Optional. If you use Entity Framework Core, go to the MySolution.Module\BusinessObjects folder, open the MySolutionDbContext.cs file. Then, register the Event and Resource types in the application’s DbContext:

    //...
    
    namespace MyApplication.Module.BusinessObjects;
    
    //..
    
    [TypesInfoInitializer(typeof(MySolutionContextInitializer))]
    public class MySolutionEFCoreDbContext : DbContext {
        public MySolutionEFCoreDbContext(DbContextOptions<MySolutionEFCoreDbContext> options) : base(options) {
        }
        public DbSet<Event> Events { get; set; }
        public DbSet<Resource> Resources { get; set; }
    
        //..
        }
    // ...
    

    Note

    If you use Entity Framework Core, any changes to the application’s data model may cause database-related exceptions when you run the application. We recommend that you use migrations to update the database schema. For more information on how to create a migration and update the database, refer to the following topic: Implement a Data Model: Basics.

  4. 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
  5. 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();
                // ...
            });
            // ...
        }
    }
    
  6. Build the project and run the application. The Scheduler Event item appears in the navigation control.

    ASP.NET Core Blazor
    Scheduler Module ASP.NET Core Blazor, DevExpress
    Windows Forms
    Scheduler Module Windows Forms, DevExpress

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.

See Also