This article describes how you can get started with CrystalQuartz Panel plugged into ASP.NET Core application.
Pre-requirements
It is assumed that you already have ASP.NET Core application up and running.
You should have an instance of Microsoft.AspNetCore.Builder.IApplicationBuilder
object
available. For web applications it is usually in Startup.cs
file.
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. |
It is also assumed that you have Quartz.NET v3 package installed and IScheduler
instance
available.
1 Setup
As a first step, you need to install CrystalQuartz.AspNetCore NuGet package to the target project:
Install-Package CrystalQuartz.AspNetCore |
That will add a CrystalQuartz.AspNetCore.dll
reference to your project.
The CrystalQuartz.AspNetCore.dll
is a single dll that contains all the
resources needed for CrystalQuartz to work.
2 Configuration
As a next step, you need to hook CrystalQuartz middleware into your
ASP.NET Core environment. It should be done by calling UseCrystalQuartz
extension method at the moment of pipeline initialization. The generic
syntax for panel configuration looks like this:
using CrystalQuartz.AspNetCore; |
The arguments are:
() => scheduler
is a provider pointing to the scheduler instance;options
is an optional for panel customization.
2.1 Configuration - Scheduler
You should already have an IScheduler
object instance so you can pass
a Func
pointing to it to the configuration extension method:
public void Configure(IApplicationBuilder app, IHostingEnvironment env) |
Or you can get IScheduler
from an IoC container if you have one configured:
/* ... */ |
2.2 Options
Second (optional) argument of UseCrystalQuartz
method allows to do some panel customizations.
The object should be an instance of CrystalQuartzOptions
class. Please check the options class
source code for details.
3 Running the panel
Once the configuration is done, you can run your project and navigate to http://YOUR_URL/quartz
to see the panel UI.