using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NFine.Repository
{
///
/// 操作数据库工厂
///
public class DataFactory
{
private static readonly Object locker = new Object();
private static Database db = null;
///
/// 获取指定的数据库连接
///
///
///
public static IDatabase Database(string connString)
{
//在并发时,使用单一对象
if (db == null)
{
return db = new Database(connString);
}
else
{
lock (locker)
{
return db;
}
}
}
///
/// 获取指定的数据库连接
///
///
public static IDatabase Database()
{
return Database("Framework_SqlServer");
}
}
}