Installation

Supports

.NET Core versions 3.1+.

Licensing

Coravel Pro is free for non-commercial usage.

Enjoy the benefits of these tools in your side-projects or early-stage indie businesses!

If (or once) your business is generating revenue you must purchase a license.

For businesses who wish to try Coravel Pro before purchasing you are free to do so within a reasonable timeframe.

Installation

Coravel Pro is distributed as a normal NuGet package (Coravel.Pro). It can be installed by any normal NuGet package installation method.

For example, using the .NET Core CLI: dotnet add package Coravel.Pro

Basic Configuration

Startup.cs

In your Startup.cs file within a ASP .NET Core application, you minimally need to add a few lines of code to get started!

ConfigureServices

At the end of the ConfigureServices method add:

services.AddCoravelPro(typeof(ApplicationDbContext));

This assumes your Db Context is named ApplicationDbContext.

.NET Core 3.0+

Before you call AddCoravelPro, you will have to add support for razor pages and Newtonsoft JSON processing:

services.AddRazorPages().AddNewtonsoftJson();

In the Configure method, you'll have to configure routing for razor pages too:

 app.UseEndpoints(endpoints =>
{
    endpoints.MapRazorPages();
});

IMPORTANT

Coravel Pro uses Coravel's Scheduling, Queuing and Event features under-the-covers.

There's therefore no need to call AddScheduler, AddQueue and AddEvents. They should be removed if they exist.

Configure

At the end of the Configure method add:

app.UseCoravelPro();

This will bootstrap an entire mini-application that exists behind the scenes of your .NET Core web application!

Database Configuration

Db Context

Coravel Pro hooks directly into your Entity Framework Core Context.

Simply make your Db Context implement the interface Coravel.Pro.EntityFramework.ICoravelProDbContext.

For each DbSet property that you implement add a public get and set.

public class ApplicationDbContext : IdentityDbContext, ICoravelProDbContext
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    { }

    public DbSet<CoravelJobHistory> Coravel_JobHistory { get; set; }
    public DbSet<CoravelScheduledJob> Coravel_ScheduledJobs { get; set; }
    public DbSet<CoravelScheduledJobHistory> Coravel_ScheduledJobHistory { get; set; }
}

Migration

Add a new Entity Framework Core migration to save your changes

dotnet ef migrations add coravelpro

Don't forget to apply your migrations to your database!

dotnet ef database update

FYI

As new Coravel Pro features are rolled-out it's likely that upgrading may involve implementing new properties from the ICoravelProDbContext interface. When the time comes we'll add extra notes to aid with any migrations 😁.

Potential Issue With SQL Server

You might get this error when applying your migrations (specifically with SQL Server):

Error: To change the IDENTITY property of a column, the column needs to be dropped and recreated.

This is not a problem with Coravel Pro - but a known issue with the SQL Server provider.

You'll have to update the built-in migration 00000000000000_CreateIdentitySchema.cs.

For the tables AspNetUserClaims and AspNetRoleClaims you need to add the following annotation at the end of each Id column definition:

migrationBuilder.CreateTable(
    name: "AspNetRoleClaims",
    columns: table => new
    {
        Id = table.Column<int>(nullable: false)
            .Annotation("Sqlite:Autoincrement", true)
            // ---------------
            // Add this one 👇
            // ---------------
            .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
        RoleId = table.Column<string>(nullable: false),
        ClaimType = table.Column<string>(nullable: true),
        ClaimValue = table.Column<string>(nullable: true)
    }

That's It!

Phew! That was easy!

To further configure features like restricting what users can use Coravel Pro, Custom Metrics, etc. see the Advanced Configuration.