.NET Core client for Coherence API
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Coherence.NET.Client.Tests
Shared
.gitignore
.travis.yml
ApplicationContextInfoCollector.cs
AssemblyInfo.cs
Coherence.NET.Client.csproj
Coherence.UpdateInstance.cs
Coherence.cs
CoherenceApi.cs
CoherenceApiConsumer.cs
JobConfig.cs
LICENSE
README.md
RuntimeConfig.cs
RuntimeConfigFramework.cs
publish.sh

README.md

Coherence API .NET Client

Run code online faster with Coherence API.

Coherence lets you deploy and run your code on a server with only two lines of code.

Read the Docs.

Supported Versions

Currently only .NET Core Versions 1.0, 1.1, and 2.0 are supported.

Full framework .NET 4.5.1 and Mono are not yet supported but are coming soon.

Install Easily with dotnet

Install the Coherence.NET python package using dotnet.

$ dotnet add package CoherenceApi

Start with only Two Lines of Code

  1. Sign up for an API key.

  2. Create a project dotnet new console and edit Program.cs

using System;
using CoherenceApi;

public class Program
{
    public static async Task Main(string[] args)
    {
        Coherence.SetApiKey("my-api-key");

        var myHostname = GetMachineName()
        var serverHostname = await Coherence.RunAsync(() =>
            GetMachineName());
            
        Console.WriteLine($"My Hostname: {myHostname}");
        Console.WriteLine($"Server Hostname: {serverHostname}");
    }
    
    public static string GetMachineName()
    {
        return Environment.MachineName;
    }
}

Any lambda passed to Coherence.RunAsync() is serialized, deployed, and run on Coherence API's servers. Notice also that Coherence.RunAsync() is integrated with the async/await pattern. The RunAsync() method returns the return value of the called function, after it has finished running on Coherence API's servers.

Run Recurring jobs

It's easy to run jobs on a cron schedule, replacing whatever external scheduling system you have with only your code.

using System;
using CoherenceApi;
using MyEmailSender;

public class Program
{
    public static async Task Main(string[] args)
    {
        Coherence.SetApiKey("my-api-key");

        // A cron expression to send a reminder every monday at midnight
        var schedule = "0 0 0 * * 1";

        // Run the SendReminder function on Coherence API according to the schedule.
        await Coherence.RunRecurring(schedule,
          () => MyEmailSender.SendReminder("welovedevs@coherenceapi.com"));
    }
}

All the Details are in the Docs

Read the Docs.