private static IMongoDatabase Connect() { log.Trace("IMongoDatabase Connect() method"); try { GetConfiguration getConf = new GetConfiguration(); #region Without Credentials //Specify Connection string string connectionString = getConf.GetConfig(GetConfiguration.ConfigType.Server); MongoClientSettings settings = MongoClientSettings.FromUrl(new MongoUrl(connectionString)); _client = new MongoClient(settings); return(_client.GetDatabase(getConf.GetConfig(GetConfiguration.ConfigType.DataBase))); #endregion } catch (MongoClientException me) { log.Error("MongoClientException [{0}]", me.Message); throw new MongoClientException(me.Message); } catch (Exception ex) { log.Error("Exception on IMongoDatabase Connect [{0}]", ex.Message); throw new Exception(ex.Message); } }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetConfiguration request) { var dateModified = File.GetLastWriteTimeUtc(_configurationManager.ApplicationPaths.SystemConfigurationFilePath); var cacheKey = (_configurationManager.ApplicationPaths.SystemConfigurationFilePath + dateModified.Ticks).GetMD5(); return(ToOptimizedResultUsingCache(cacheKey, dateModified, null, () => _configurationManager.Configuration)); }
protected virtual GetConfiguration GetConfiguredConfiguration(GetConfiguration configuration, Action <IGetConfigurationBuilder> action) { if (action == null) { return(configuration); } var builder = new GetConfigurationBuilder(configuration); action.Invoke(builder); return(builder.Configuration); }
public async Task <ActionResult <ConfigurationDto> > GetAsync([FromRoute] GetConfiguration query) { var product = await _dispatcher.QueryAsync(query); if (product is null) { return(NotFound()); } return(product); }
public DBConnection() { SQLConnection = new MySqlConnection(); var con = new GetConfiguration(); SQLConnection.ConnectionString = con.GetConnectionString().GetSection("ConnectionStrings").GetSection("CoreDB").Value; SQLConnection.Open(); SQLCommand = new MySqlCommand(); SQLCommand.Connection = SQLConnection; SQLCommand.CommandType = CommandType.StoredProcedure; SQLParameters = new List <MySqlParameter>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { GetConfiguration._configuration = Configuration; services.AddDbContext <MariaDatabaseContext>(options => options.UseMySql(GetConfiguration.GetAppSettings("MariaDB", "ConnectionString"))); services.AddTransient <IDatabaseContext, MongoDatabaseContext> (/*typeof(IDatabaseContext), typeof(MariaDatabaseContext)*/); services.AddTransient(typeof(IDatabaseConnector <>), typeof(MongoDatabaseConnector <>)); services.AddTransient(typeof(IRepository <>), typeof(BaseRepository <>)); services.AddControllersWithViews(); }
public IMongoCollection <BsonDocument> Get() { log.Trace("IMongoDatabase Get() method"); try { GetConfiguration getConf = new GetConfiguration(); return(Connect().GetCollection <BsonDocument>(getConf.GetConfig(GetConfiguration.ConfigType.Collection))); } catch (MongoClientException ex) { log.Error("MongoClientException [{0}]", ex.Message); throw new MongoClientException(ex.Message); } catch (Exception ex) { log.Error("Exception on IMongoDatabase Connect [{0}]", ex.Message); throw new Exception(ex.Message); } }
/// <summary> /// Reads all the devices from the PLM and stores the mapping locally. Along with the /// basic info and config of the plm. /// </summary> public bool Startup() { GetInfo info = new GetInfo(); PowerLineModemMessage.MessageResponse response = port.SendCommand(info); if (response == PowerLineModemMessage.MessageResponse.Ack) { plm = new PowerLineModule(this, info.Id, info.Category, info.Subcategory, info.FirmwareVersion); // Ask for the config and info about the modem. GetConfiguration config = new GetConfiguration(); response = port.SendCommand(config); if (response == PowerLineModemMessage.MessageResponse.Ack) { plm.Config = config.Configuration; this.ReadAllLinks(); this.SetupAllDevices(); return(true); } } return(false); }
public void Dispose() { // Clearing all of these ensures that the transient APIs // can't be called outside of the appropriate scope. #region dispose-dispatcher service-apis _GetNuGetExePath = null; _GetNuGetDllPath = null; _DownloadFile = null; _AddPinnedItemToTaskbar = null; _RemovePinnedItemFromTaskbar = null; _CreateShortcutLink = null; _UnzipFileIncremental = null; _UnzipFile = null; _AddFileAssociation = null; _RemoveFileAssociation = null; _AddExplorerMenuItem = null; _RemoveExplorerMenuItem = null; _SetEnvironmentVariable = null; _RemoveEnvironmentVariable = null; _AddFolderToPath = null; _RemoveFolderFromPath = null; _InstallMSI = null; _RemoveMSI = null; _StartProcess = null; _InstallVSIX = null; _UninstallVSIX = null; _InstallPowershellScript = null; _UninstallPowershellScript = null; _SearchForExecutable = null; _GetUserBinFolder = null; _GetSystemBinFolder = null; _CopyFile = null; _CopyFolder = null; _Delete = null; _DeleteFolder = null; _CreateFolder = null; _DeleteFile = null; _BeginTransaction = null; _AbortTransaction = null; _EndTransaction = null; _GenerateUninstallScript = null; _GetKnownFolder = null; _IsElevated = null; #endregion #region dispose-dispatcher core-apis _Warning = null; _Message = null; _Error = null; _Debug = null; _Verbose = null; _ExceptionThrown = null; _Progress = null; _ProgressComplete = null; _GetHostDelegate = null; _IsCancelled = null; #endregion #region dispose-dispatcher request-apis _OkToContinue = null; _YieldPackage = null; _YieldPackageDetails = null; _YieldPackageSwidtag = null; _YieldSource = null; _YieldMetadataDefinition = null; _YieldInstallationOptionsDefinition = null; #endregion #region dispose-dispatcher host-apis _GetMetadataKeys = null; _GetMetadataValues = null; _GetInstallationOptionKeys = null; _GetInstallationOptionValues = null; _PackageSources = null; _GetConfiguration = null; _ShouldContinueWithUntrustedPackageSource = null; _ShouldProcessPackageInstall = null; _ShouldProcessPackageUninstall = null; _ShouldContinueAfterPackageInstallFailure = null; _ShouldContinueAfterPackageUninstallFailure = null; _ShouldContinueRunningInstallScript = null; _ShouldContinueRunningUninstallScript = null; _AskPermission = null; _WhatIf = null; #endregion #region dispose-dispatcher protocol-apis _ProtocolGetNames = null; _ProtocolIsValidSource = null; _ProtocolGetItemMetadata = null; _ProtocolDownloadItem = null; _ProtocolUnpackItem = null; _InstallItem = null; #endregion _callback = null; }
public IEnumerable <string> GetConfiguration(string path) { CheckDisposed(); return((_GetConfiguration ?? (_GetConfiguration = (_callback.Resolve <GetConfiguration>() ?? ((ppath) => default(IEnumerable <string>)))))(path)); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetConfiguration request) { return(ToOptimizedResult(_configurationManager.Configuration)); }
public void GetConfigurationTest() { GetConfiguration request = new GetConfiguration(); var result = JsonConvert.DeserializeObject <KodiJSON.JSONRPC.Response.GetConfigurationResponse>(ExecuteTest.GetResponse(request)); }
public GetConfigurationBuilder(GetConfiguration config = null) { Configuration = config ?? new GetConfiguration(); }
public static void Run([TimerTrigger("0 0 6 * * *")] TimerInfo myTimer, ILogger log, ExecutionContext context) { var appsRc = new GetConfiguration(context).Execute(); new Comics(appsRc).Execute(); }
public MongoDatabaseContext() { _mongoClient = new MongoClient(GetConfiguration.GetAppSettings("MongoDB", "ConnectionString") /*"mongodb://localhost:27017/?readPreference=primary&appname=MongoDB%20Compass%20Community&ssl=false"*/); _mongoDatabase = _mongoClient.GetDatabase(GetConfiguration.GetAppSettings("MongoDB", "DatabaseName") /*"BVMinh_MongoDb"*/); }