private static void Main()
{
try
{
// Creating a FabricRuntime connects this host process to the Service Fabric runtime.
using(FabricRuntime fabricRuntime = FabricRuntime.Create())
{
CqrsApplication.SetService<IDeserializer>(new Deserializer());
CqrsApplication.SetService(new QueryRepository());
// The ServiceManifest.XML file defines one or more service type names.
// RegisterServiceType maps a service type name to a .NET class.
// When Service Fabric creates an instance of this service type,
// an instance of the class is created in this host process.
fabricRuntime.RegisterServiceType("QueryModelBuilderServiceType", typeof(QueryModelBuilderService));
ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(QueryModelBuilderService).Name);
Thread.Sleep(Timeout.Infinite); // Prevents this host process from terminating to keep the service host process running.
}
}
catch(Exception e)
{
ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
throw;
}
}
}