public OrderRepository(ILocalDb db) { _db = db; }
public PayNowCommand(ILocalDb localDb, ICommandDelegate <PayNowResponce> commandDelegate) : base(localDb, commandDelegate) { }
public MovieRepository(ILocalDb db) { _db = db; }
public CreateCreditCommand(ILocalDb localDb, ICommandDelegate <CreateCreditResponce> commandDelegate) : base(localDb, commandDelegate) { }
public RecalculatingCommand(ILocalDb localDb, ICommandDelegate <RecalculatingResponce> commandDelegate) : base(localDb, commandDelegate) { }
public UserService() { _db = new LocalDb(); }
private static async Task Main() { var mqttStarted = true; var restStarted = true; _verboseLog = Settings.Default.VerboseLog; LogToScreen("MQTTBroker"); try { if (Settings.Default.UseLiteDb) { RecordsDb = new LiteDbLocal(Settings.Default.DbFileName + ".litedb", Settings.Default.ClientID); LogToScreen("DataBase name: " + Settings.Default.DbFileName + ".litedb"); LogToScreen("Collection name: " + Settings.Default.ClientID); } else { RecordsDb = new SqLiteDbLocalContext(Settings.Default.DbFileName + ".sqlite"); LogToScreen("DataBase name: " + Settings.Default.DbFileName + ".sqlite"); } _dbStarted = true; } catch (Exception e) { LogToScreen("Database connection error: " + e); _dbStarted = false; } // Setup MQTT server settings var optionsBuilder = new MqttServerOptionsBuilder() .WithConnectionValidator(MqttConnectHandler) .WithSubscriptionInterceptor(MqttSubscribeHandler) .WithApplicationMessageInterceptor(MqttPublishHandler) .WithUnsubscriptionInterceptor(new MqttUnSubscribeHandler()) .WithConnectionBacklog(100) .WithDefaultEndpointPort(Settings.Default.MQTTPort); var mqttServer = new MqttFactory().CreateMqttServer(); mqttServer.ClientDisconnectedHandler = new MqttDisconnectHandler(); // MQTT server start try { await mqttServer.StartAsync(optionsBuilder.Build()).ConfigureAwait(true); LogToScreen("MQTT: port: " + Settings.Default.MQTTPort); } catch (Exception e) { LogToScreen("MQTT: server start error: " + e); mqttStarted = false; } // REST API start using (var restConfig = new HttpSelfHostConfiguration(Settings.Default.RESTHost + ":" + Settings.Default.RESTPort)) { restConfig.Routes.MapHttpRoute( "API Default", "api/{controller}/{action}/{id}", new { id = RouteParameter.Optional }); restConfig.MapHttpAttributeRoutes(); restConfig.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; restConfig.TransferMode = TransferMode.StreamedResponse; restConfig.ClientCredentialType = HttpClientCredentialType.Basic; restConfig.UserNamePasswordValidator = new RestUserValidator(); /*var f = restConfig.Formatters; * f.JsonFormatter.UseDataContractJsonSerializer = true; * f.JsonFormatter.SerializerSettings.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;*/ var f = restConfig.Formatters; //f.JsonFormatter.UseDataContractJsonSerializer = true; f.JsonFormatter.SerializerSettings.DateFormatHandling = DateFormatHandling.IsoDateFormat; f.JsonFormatter.SerializerSettings.DateFormatString = "yyyy-MM-ddTHH:mm:ss.FFFK"; using (var restServer = new HttpSelfHostServer(restConfig)) { try { restServer.OpenAsync().Wait(); LogToScreen("REST: started at: " + Settings.Default.RESTHost + ":" + Settings.Default.RESTPort); } catch (Exception e) { LogToScreen("REST: server start error: " + e); restStarted = false; } if (!mqttStarted) { LogToScreen("Can't start MQTT server."); } if (!restStarted) { LogToScreen("Can't start REST server."); } if (!mqttStarted || !restStarted) { LogToScreen("Closing application..."); await mqttServer.StopAsync().ConfigureAwait(false); RecordsDb?.Dispose(); return; } var resp = ""; while (resp?.ToLowerInvariant() != "exit") { LogToScreen("Enter \"exit\" to quit."); resp = Console.ReadLine(); } } } await mqttServer.StopAsync().ConfigureAwait(false); RecordsDb?.Dispose(); }
public CustomPayCommand(ILocalDb localDb, ICommandDelegate <CustomPayResponce> commandDelegate) : base(localDb, commandDelegate) { }
protected CommonCommand(ILocalDb localDb, ICommandDelegate <T> commandDelegate) { LocalDatabase = localDb; Delegate = commandDelegate; }
public GetListCommand(ILocalDb localDb, ICommandDelegate <GetListResponce> commandDelegate) : base(localDb, commandDelegate) { }
public AvialableCreditCommand(ILocalDb localDb, ICommandDelegate <AvialableCreditResponce> commandDelegate) : base(localDb, commandDelegate) { }
public UserRepository(ILocalDb db) { _db = db; }
public RegistrationCommand(ILocalDb localDb, ICommandDelegate <RegistrationResponce> commandDelegate) : base(localDb, commandDelegate) { }
public CalculateCommand(ILocalDb localDb, ICommandDelegate <CalculateResponce> commandDelegate) : base(localDb, commandDelegate) { }
public RegisServices() { _dv = new LocalDb <T>(); }
public LoginCommand(ILocalDb localDb, ICommandDelegate <LoginResponceViewModel> commandDelegate) : base(localDb, commandDelegate) { }