Installation

Requirements

  • .NET Core 2.1+
  • Entity Framework Core 2.1+
  • Coravel 2.3.0+

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.

Installing Coravel Pro

Coravel Pro is distributed as a normal NuGet package (Coravel.Pro) - and therefore 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 you minimally need to add two lines of code to get started.

ConfigureServices

In the ConfigureServices method you need to add:

services.AddCoravelPro(typeof(ApplicationDbContext));

This assumes your Db Context is named ApplicationDbContext.

AddCoravelPro informs Coravel Pro of what Db Context it should use to fetch and store it's data (among other magical things that it does).

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, and should be removed if they exist.

Existing Coravel code will function as normal.

Configure

In the Configure method add:

app.UseCoravelPro();

This will setup 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 will 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.