/// <summary> /// The default constructor. /// </summary> /// <param name="name">The service name.</param> /// <param name="context">This is config context.</param> /// <param name="configure">This is the link to configuration pipeline for the Microservice</param> /// <param name="init"></param> public MicroservicePersistenceWrapper(string name , ConsoleSettings context , Action <MicroservicePersistenceWrapper <K, E> > configure , Action <MicroservicePersistenceWrapper <K, E> > init = null) { if (configure == null) { throw new ArgumentNullException("configure"); } if (context == null) { throw new ArgumentNullException("context"); } Context = context; Name = name; mConfigure = configure; mInit = init; PipelineInitialise(); }
static void Main(string[] args) { //The context holds the active data for the console application. sSettings = new ConsoleSettings(args); sClient = new MicroservicePersistenceWrapper <Guid, MondayMorningBlues>("TestClient", sSettings, ClientConfig); sServer = new MicroservicePersistenceWrapper <Guid, MondayMorningBlues>("TestServer", sSettings, ServerConfig, ServerInit); sApiServer = new ApiPersistenceConnector <Guid, MondayMorningBlues>(ApiConfig); //Attach the client events. sClient.StatusChanged += StatusChanged; sServer.StatusChanged += StatusChanged; sApiServer.StatusChanged += StatusChanged; //Show the main console menu. sMenuMain.Value.Show(args, shortcut: sSettings.Shortcut); //Detach the client events to allow the application to close. sClient.StatusChanged -= StatusChanged; sServer.StatusChanged -= StatusChanged; sApiServer.StatusChanged -= StatusChanged; }