/// <summary> /// This is the entry point of the service host process. /// </summary> private static void Main() { try { // The ServiceManifest.XML file defines one or more service type names. // Registering a service maps a service type name to a .NET type. // When Service Fabric creates an instance of this service type, // an instance of the class is created in this host process. ServiceRuntime.RegisterServiceAsync("DinnerMenuServiceType", delegate(StatefulServiceContext context) { var stateMngr = new ReliableStateManager(context); var backupStore = new FileStoreCreator().CreateFileStore(context); return(new DinnerMenuService(context, new DishStateManager(stateMngr), stateMngr, backupStore, ServiceEventSource.Current)); }).GetAwaiter().GetResult(); ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(DinnerMenuService).Name); // Prevents this host process from terminating so services keep running. Thread.Sleep(Timeout.Infinite); } catch (Exception e) { ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString()); throw; } }
/// <summary> /// This is the entry point of the service host process. /// </summary> private static void Main() { try { // This line registers an Actor Service to host your actor class with the Service Fabric runtime. // The contents of your ServiceManifest.xml and ApplicationManifest.xml files // are automatically populated when you build this project. // For more information, see https://aka.ms/servicefabricactorsplatform ActorRuntime.RegisterActorAsync <OrderActor>( delegate(StatefulServiceContext context, ActorTypeInformation actorType) { var backupStore = new FileStoreCreator().CreateFileStore(context); return(new OrderActorService(context, actorType, backupStore, ActorEventSource.Current)); }).GetAwaiter().GetResult(); Thread.Sleep(Timeout.Infinite); } catch (Exception e) { ActorEventSource.Current.ActorHostInitializationFailed(e.ToString()); throw; } }