Ejemplo n.º 1
0
 public DataSource(
     string name, DataProvider provider, string connectionString,
     string commandDir, string commandFileMask)
 {
     _name = name;
     _provider = provider;
     _connectionString = connectionString;
     _commandFactory = new DataCommandFactory(this, commandDir, commandFileMask);
     _templateConnection = (IDbConnection)Activator.CreateInstance(_provider.ConnectionObjectType);
     _templateCommand = (IDbCommand)Activator.CreateInstance(_provider.CommandObjectType);
     _templateDataAdapter = (DbDataAdapter)Activator.CreateInstance(_provider.DataAdapterObjectType);
 }
		public DataCommandFactory(
			DataSource dataSource, string commandDir, string commandFileMask)
		{
			_dataSource = dataSource;
			_provider = dataSource.Provider;
			_commandDir = commandDir;
			_commandFileMask = commandFileMask;

			//set the watcher
			_watcher = 
				new FileSystemWatcher(_commandDir, _commandFileMask);
			_watcher.NotifyFilter = NotifyFilters.LastWrite;
			_watcher.Changed += new FileSystemEventHandler(Config_Changed);
			_watcher.EnableRaisingEvents = true;

			_configsLastChanged = new Hashtable();
		}