using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Data.SqlClient;
namespace Model
{
public class Database
{
private bool _connected;
private string _connectionstring;
private List<string> _storeprocedures = new List<string>();
private List<Table> _tables = new List<Table>();
private DatabaseType _type;
private List<string> _views = new List<string>();
public bool Connected
{
get
{
return this._connected;
}
set
{
this._connected = value;
}
}
public string ConnectionString
{
get
{
return this._connectionstring;
}
set
{
this._connectionstring = value;
}
}
public string DatabaseName
{
get
{
if (this._type == DatabaseType.Access)
{
OleDbConnection connection = new OleDbConnection(this._connectionstring);
return connection.DataSource;
}
SqlConnection connection2 = new SqlConnection(this._connectionstring);
return connection2.Database;
}
}
public List<string> StoreProcedures
{
get
{
return this._storeprocedures;
}
set
{
this._storeprocedures = value;
}
}
public List<Table> Tables
{
get
{
return this._tables;
}
set
{
this._tables = value;
}
}
public DatabaseType Type
{
get
{
return this._type;
}
set
{
this._type = value;
}
}
public List<string> Views
{
get
{
return this._views;
}
set
{
this._views = value;
}
}
public enum DatabaseType
{
Access,
Sql2000,
Sql2005
}
}
}

浙公网安备 33010602011771号