コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <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;
     }
 }
コード例 #3
0
        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;
        }