Skip to content

Instantly share code, notes, and snippets.

@markdchurchill
Last active September 29, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markdchurchill/3ddd09a3641d7ebc49a251d8ced6a3f7 to your computer and use it in GitHub Desktop.
Save markdchurchill/3ddd09a3641d7ebc49a251d8ced6a3f7 to your computer and use it in GitHub Desktop.
Basic example usage of Condense Light
using System;
using Condense.Core;
using Condense.Light;
namespace DemoApplication
{
[Entity]
public class GuestArrival
{
public string Name { get; set; }
}
[Entity]
public class GreetingRequest
{
public string Name { get; set; }
}
[Entity]
public class Greeting
{
public string Text { get; set; }
}
public interface IIntegration
{
Greeting HelloWorld(GuestArrival arrival);
}
class Program
{
static void Main(string[] args)
{
var host = CondenseLight.BuildFor<GuestArrival>(inMemoryStorage: true);
var integration = host.GetIntegration<IIntegration>();
var arrival = new GuestArrival()
{
Name = "Human"
};
var greeting = integration.HelloWorld(arrival);
Console.WriteLine(greeting.Text);
}
[Lambda]
public static GreetingRequest OnGuestArrival(GuestArrival arrival)
{
return new GreetingRequest()
{
Name = arrival.Name
};
}
[Lambda]
public static Greeting ProcessGreetingRequest(GreetingRequest request)
{
return new Greeting()
{
Text = "Hello, " + request.Name
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment