本文整理汇总了C#中DataBaseType类的典型用法代码示例。如果您正苦于以下问题:C# DataBaseType类的具体用法?C# DataBaseType怎么用?C# DataBaseType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataBaseType类属于命名空间,在下文中一共展示了DataBaseType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContextConnection
/// <summary>
/// 上下文初始化器(只赋值,不初始化,有可能被重复创建两次)
/// </summary>
/// <param name="connectionString">连接字符串</param>
/// <param name="dbType">数据库类型</param>
/// <param name="commandTimeout">命令超时时间</param>
/// <param name="dataVer">数据库版本</param>
public ContextConnection(string connectionString, DataBaseType dbType, int commandTimeout, string dataVer)
{
this.ConnectionString = connectionString;
this.DbType = dbType;
this.CommandTimeout = commandTimeout;
this.DataVer = dataVer;
}
示例2: DBHelper
public DBHelper(ConnectionType conncetionType, DataBaseType DBMSType,string strDBFileNamePath)
{
DbConnectionType = conncetionType;
dbType = DBMSType;
S_DBFILENAME = strDBFileNamePath;
oFactory = DbProviderFactories.GetFactory(RetreiveConnectionString());
}
示例3: PlotVarDB_Load
private void PlotVarDB_Load(object sender, EventArgs e)
{
database = new DataBaseType();
database.ME1 = new List<PlotVarEntry>();
database.ME2 = new List<PlotVarEntry>();
database.ME3 = new List<PlotVarEntry>();
}
示例4: DBAccess
public DBAccess(DataBaseType dbType,string connectionString)
{
this._dbType = dbType;
this._connectionString = connectionString;
this.dbAccess= new DataBaseAccess(this._dbType, this._connectionString);
}
示例5: ContextAttribute
/// <summary>
/// 默认第一个数据库配置
/// </summary>
/// <param name="connectionString">数据库连接字符串</param>
/// <param name="dbType">数据库类型</param>
/// <param name="dataVer">数据库版本</param>
/// <param name="commandTimeout">SQL执行超时时间</param>
public ContextAttribute(string connectionString, DataBaseType dbType = DataBaseType.SqlServer, string dataVer = "2008", int commandTimeout = 30)
{
ConnStr = connectionString;
DataType = dbType;
DataVer = dataVer;
CommandTimeout = commandTimeout;
}
示例6: GetConnectionString
public static ConnectionString GetConnectionString(string connectionString, DataBaseType type)
{
var values = connectionString.Split((";").ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var eConnectionString = new ConnectionString();
eConnectionString.String = connectionString;
eConnectionString.Type = type;
switch (eConnectionString.Type)
{
case DataBaseType.SqlServer:
eConnectionString.Server = values[0].Split('=')[1];
eConnectionString.DataSource = values[1].Split('=')[1];
eConnectionString.User = values[2].Split('=')[1];
eConnectionString.Password = values[3].Split('=')[1];
break;
case DataBaseType.Oracle:
eConnectionString.DataSource = values[0].Split('=')[1];
eConnectionString.User = values[1].Split('=')[1];
eConnectionString.Password = values[2].Split('=')[1];
break;
}
return eConnectionString;
}
示例7: GetDatabaseCountQuery
public string GetDatabaseCountQuery(DataBaseType dbType)
{
if (dbType == DataBaseType.Mssql)
return "SELECT LTRIM(STR(COUNT(name))) FROM master..sysdatabases";
return "SELECT COUNT(schema_name) FROM information_schema.SCHEMATA";
}
示例8: GetFunctionExtractObjectsArgs
private ExtractObjectsArgs GetFunctionExtractObjectsArgs(DataBaseType dbType)
{
switch (dbType)
{
case DataBaseType.Oracle:
return new ExtractObjectsArgs(
Settings.Oracle.Function.Default.Regex,
_inputText,
Settings.Oracle.Function.Default.DropEnding,
Settings.Oracle.Function.Default.DropReplace,
Settings.Oracle.Function.Default.CreateEnding,
Settings.Oracle.Function.Default.CreateSearch,
Settings.Oracle.Function.Default.CreateReplace,
_functions,
delegate(string str) { return str.Equals("\r\nBEGIN\r\nRETURN NULL;\r\n"); });
case DataBaseType.SQLServer:
return new ExtractObjectsArgs(
Settings.SQLServer.Function.Default.Regex,
_inputText,
Settings.SQLServer.Function.Default.DropEnding,
Settings.SQLServer.Function.Default.DropReplace,
Settings.SQLServer.Function.Default.CreateEnding,
Settings.SQLServer.Function.Default.CreateSearch,
Settings.SQLServer.Function.Default.CreateReplace,
_functions,
delegate(string str) { return str.Equals(" begin\r\nreturn NULL\r\n"); });
default:
throw new NotSupportedException(
String.Format("{0} is not a valid DataBase Type!",
(DataBaseType)dbType));
}
}
示例9: CreateDataBase
public bool CreateDataBase(DataBaseType nType, string nConnectionString, byte[] nRemotingPassword, out DataBase nDataBase, out string nMessage)
{
nMessage = "";
nDataBase = null;
try
{
if (this.ServerPassword == Crypto.RSADecryptText(nRemotingPassword, this.ServerPrivateKey))
{
nDataBase = DataBaseFactory.CreateDatabase(nType, DataBaseFactory.GetInnerConnectionString(nConnectionString));
nDataBase._proxy = this;
this._DataBaseList.Add(nDataBase._token, nDataBase);
return true;
}
else
{
throw new Exception("La contraseña de acceso al servidor remoting no es válida");
}
}
catch (Exception ex)
{
nMessage = ex.Message;
}
return false;
}
示例10: GetDatarowsCount
public string GetDatarowsCount(string databaseName, string tableName, DataBaseType dbType)
{
if (dbType == DataBaseType.Mssql)
return "SELECT LTRIM(STR(COUNT(*))) FROM " + databaseName + ".." + tableName + "";
return "SELECT COUNT(*) FROM " + databaseName + "." + tableName;
}
示例11: DbGetVersion
public string DbGetVersion(DataBaseType dbType)
{
if (dbType == DataBaseType.Mssql)
return "@@VERSION";
return "VERSION()";
}
示例12: DbGetUser
public string DbGetUser(DataBaseType dbType)
{
if (dbType == DataBaseType.Mssql)
return "SYSTEM_USER";
return "CURRENT_USER()";
}
示例13: DbGetDatabase
public string DbGetDatabase(DataBaseType dbType)
{
if (dbType == DataBaseType.Mssql)
return "DB_NAME()";
return "DATABASE()";
}
示例14: GetDataBase
/// <summary>
/// 返回数据库操作
/// </summary>
/// <param name="databaseName">数据库名称</param>
/// <param name="dbType">数据库类型</param>
/// <returns>返回数据库</returns>
internal static Database GetDataBase(string databaseName,DataBaseType dbType)
{
if(dbType == DataBaseType.Write)
{
return DatabaseFactory.GetWriteDatabase(databaseName);
}
return DatabaseFactory.GetReadDatabase(databaseName);
}
示例15: DbExecutor
/// <summary>
/// 构造函数
/// </summary>
/// <param name="dbType">数据库类型</param>
/// <param name="connectionString">数据库连接字符串</param>
/// <param name="commandTimeout">数据库执行时间,单位秒</param>
/// <param name="tranLevel">开启事务等级</param>
public DbExecutor(string connectionString, DataBaseType dbType = DataBaseType.SqlServer, int commandTimeout = 30, IsolationLevel tranLevel = IsolationLevel.Unspecified)
{
_connectionString = connectionString;
_commandTimeout = commandTimeout;
DataType = dbType;
OpenTran(tranLevel);
}