top of page

Hello Perigee, Welcome to the .NET Integration World!

Updated: Aug 18, 2023



Hello, creative coders! Today, we're about to embark on a mission to boldly code where no one has coded before. 🖖


We're venturing into the pulsating heart of the .NET universe - the Perigee application. And trust me, it's easier than tying your shoelaces. For a more immersive experience, be sure to check out the video at the end of this post!


Installation


First things first: if you've not yet installed .NET 5/6+ console application, pause right here. Do yourself a favor and get that sorted. We can wait. Done? Excellent!


So let's launch. Navigate to your 'Program.cs' file. Depending on your .NET version, you'll be greeted by two distinct sights.


For the trendsetters who are already on .NET 6++, you'll see something like this:

// See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!"); 
//YOUR CODE HERE

Sweep aside that 'Console.WriteLine("Hello, World!");' on Line 2 - we're about to take things to the next level!


For those cruising with .NET 5 or earlier, you'll be confronted by this:

class Program {     

    static void Main(string[] args) {
        //YOUR CODE HERE     
    } 
 }

For you, Line 6 is where your code-odyssey begins.


First Application - "Hello Perigee"


Once we know where we're setting up camp, let's take a look at a simple Perigee application:

//A fully managed perigee application!  PerigeeApplication.ApplicationNoInit("FirstApp",  (taskConfig) => {

});

Line 2 is where you christen your application (the "FirstApp" can be anything that tickles your fancy), and Line 3 is where we slot in our thread-managed tasks. Sounds like Greek? Don't fret, that's why we're here!


Be sure to include everything in your using statements by clicking the magic wand icon or pressing ctrl+. to locate those elusive missing namespaces.

using Microsoft.Extensions.Logging; 
using Perigee;

Next stop, thread managed code. What's a coding tutorial without the iconic "Hello, World!" greeting? Here, we'll use a CRON method to log "Hello Perigee" every 15 seconds!

//A fully managed perigee application! 
using Microsoft.Extensions.Logging; 
using Perigee; 

PerigeeApplication.ApplicationNoInit("FirstApp", (taskConfig) => {
  taskConfig.AddCRON("HelloWorld", "*/15 * * * * *", (ct, log)=> 
  { 
     log.LogInformation("Hello Perigee from {appName}", taskConfig.AppName);
  }); 
});

Line 4 introduces .AddCRON() (name, CRON string, and callback).

Line 6 has the built-in logger delivering our greeting in a templated format, complete with the application name.


Run the application, and bask in the glory of a new log line every 15 seconds!

And when it's time to bid adieu? A graceful CTRL-C triggers a safe shutdown procedure, allowing your application to stop all running tasks before bowing out.


I can already see your fingertips itching to get coding! Need a live-action guide to assist you through your journey? Take a leap into our accompanying video that’s ready to teleport you into the mesmerizing world of Perigee applications. Buckle up and hit the play button now! Happy coding!


Prefer to watch me type?


That's okay, I like typing. Enjoy the show!



 

Follow all the exciting developments of the Perigee Revolution by joining our Perigee Email List today! Or simply email us at info@perigee.software



Watch the latest disrupting videos at Perigee Software - YouTube



Tweet at us at @PerigeeNinja




Get full documentation with ready-to-run examples at Perigee Documentation




Like us on Facebook at Perigee Facebook Page


 

22 views0 comments

Comments


bottom of page