Basic example usage of Condense Light
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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