/// <summary> /// Create the specified configuration. /// </summary> /// <returns>The create.</returns> /// <param name="configuration">Configuration.</param> public DataContextOptions <TContext> Create(DataContextConfiguration configuration) { var options = new DataContextOptions <TContext>(); BuildOptions(options, configuration); return(options); }
/// <summary> /// Sets the config file path. /// </summary> /// <param name="filePath">File path.</param> public static void SetConfigFilePath(string filePath) { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentNullException(nameof(filePath)); } if (instance != null) { throw new LightDataException(SR.ConfigurationHasBeenInitialized); } lock (locker) { gobalConfigFilePath = filePath; instance = null; } }
void BuildOptions(DataContextOptions options, DataContextConfiguration configuration) { DataContextOptions baseOptions = null; if (_configName == null) { baseOptions = configuration.DefaultOptions; } else { baseOptions = configuration.GetOptions(_configName); } options.Database = baseOptions.Database; options.Connection = baseOptions.Connection; options.CommandOutput = _commandOutput; }