标签:clean ltm cut end provider exe time etc tco
PetaPoco Database API
#region IDisposable
public void Dispose()
#endregion
#region Constructors
public Database()
public Database(IDbConnection connection)
public Database(string connectionString, string providerName = null)
public Database(string connectionString, DbProviderFactory factory)
public Database(string connectionStringName)
public Database(string connectionString, IProvider provider, IMapper defaultMapper = null)
public Database(IDatabaseBuildConfiguration configuration)
#endregion
#region Connection Management
public bool KeepConnectionAlive;
public void OpenSharedConnection();
public void CloseSharedConnection();
public IDbConnection Connection;
#endregion
#region Transaction Management
// Helper to create a transaction scope
public ITransaction GetTransaction()
public virtual void OnBeginTransaction()
public virtual void OnEndTransaction()
public void BeginTransaction()
private void CleanupTransaction()
public void AbortTransaction()
public void CompleteTransaction()
#endregion
#region Command Management
private void AddParam(IDbCommand cmd, object value, PropertyInfo pi)
// Create a command
private static Regex rxParamsPrefix = new Regex(@"(?Exception Reporting and Logging
public virtual bool OnException(Exception x)
public virtual IDbConnection OnConnectionOpened(IDbConnection conn)
public virtual void OnConnectionClosing(IDbConnection conn)
public virtual void OnExecutingCommand(IDbCommand cmd)
public virtual void OnExecutedCommand(IDbCommand cmd)
#endregion
#region operation: Execute
public int Execute(string sql, params object[] args)
public int Execute(Sql sql)
#endregion
#region operation: ExecuteScalar
public T ExecuteScalar(string sql, params object[] args)
public T ExecuteScalar(Sql sql)
#endregion
#region operation: Fetch
public List Fetch(string sql, params object[] args)
public List Fetch(Sql sql)
#endregion
#region operation: Page
public Page Page(long page, long itemsPerPage, string sqlCount, object[] countArgs, string sqlPage, object[] pageArgs)
public Page Page(long page, long itemsPerPage, string sql, params object[] args)
public Page Page(long page, long itemsPerPage, Sql sql)
public Page Page(long page, long itemsPerPage, Sql sqlCount, Sql sqlPage)
#endregion
#region operation: Fetch (page)
public List Fetch(long page, long itemsPerPage, string sql, params object[] args)
public List Fetch(long page, long itemsPerPage, Sql sql)
#endregion
#region operation: SkipTake
public List SkipTake(long skip, long take, string sql, params object[] args)
public List SkipTake(long skip, long take, Sql sql)
#endregion
#region operation: Query
public IEnumerable Query(string sql, params object[] args)
public IEnumerable Query(Sql sql)
#endregion
#region operation: Exists
public bool Exists(string sqlCondition, params object[] args)
public bool Exists(object primaryKey)
#endregion
#region operation: linq style (Exists, Single, SingleOrDefault etc...)
public T Single(object primaryKey)
public T SingleOrDefault(object primaryKey)
public T Single(string sql, params object[] args)
public T SingleOrDefault(string sql, params object[] args)
public T First(string sql, params object[] args)
public T FirstOrDefault(string sql, params object[] args)
public T Single(Sql sql)
public T SingleOrDefault(Sql sql)
public T First(Sql sql)
public T FirstOrDefault(Sql sql)
#endregion
#region operation: Insert
public object Insert(string tableName, object poco)
public object Insert(string tableName, string primaryKeyName, object poco)
public object Insert(string tableName, string primaryKeyName, bool autoIncrement, object poco)
public object Insert(object poco)
private object ExecuteInsert(string tableName, string primaryKeyName, bool autoIncrement, object poco)
#endregion
#region operation: Update
public int Update(string tableName, string primaryKeyName, object poco, object primaryKeyValue)
public int Update(string tableName, string primaryKeyName, object poco, object primaryKeyValue, IEnumerable columns)
public int Update(string tableName, string primaryKeyName, object poco)
public int Update(string tableName, string primaryKeyName, object poco, IEnumerable columns)
public int Update(object poco, IEnumerable columns)
public int Update(object poco)
public int Update(object poco, object primaryKeyValue)
public int Update(object poco, object primaryKeyValue, IEnumerable columns)
public int Update(string sql, params object[] args)
public int Update(Sql sql)
private int ExecuteUpdate(string tableName, string primaryKeyName, object poco, object primaryKeyValue, IEnumerable columns)
#endregion
#region operation: Delete
public int Delete(string tableName, string primaryKeyName, object poco)
public int Delete(string tableName, string primaryKeyName, object poco, object primaryKeyValue)
public int Delete(object poco)
public int Delete(object pocoOrPrimaryKey)
public int Delete(string sql, params object[] args)
public int Delete(Sql sql)
#endregion
#region operation: IsNew
public bool IsNew(string primaryKeyName, object poco)
protected virtual bool IsNew(string primaryKeyName, PocoData pd, object poco)
public bool IsNew(object poco)
#endregion
#region operation: Save
public void Save(string tableName, string primaryKeyName, object poco)
public void Save(object poco)
#endregion
#region operation: Multi-Poco Query/Fetch
public List Fetch(Func cb, string sql, params object[] args)
public List Fetch(Func cb, string sql, params object[] args)
public List Fetch(Func cb, string sql, params object[] args)
public IEnumerable Query(Func cb, string sql, params object[] args)
public IEnumerable Query(Func cb, string sql, params object[] args)
public IEnumerable Query(Func cb, string sql, params object[] args)
public List Fetch(Func cb, Sql sql)
public List Fetch(Func cb, Sql sql)
public List Fetch(Func cb, Sql sql)
public IEnumerable Query(Func cb, Sql sql)
public IEnumerable Query(Func cb, Sql sql)
public IEnumerable Query(Func cb, Sql sql)
public List Fetch(string sql, params object[] args)
public List Fetch(string sql, params object[] args)
public List Fetch(string sql, params object[] args)
public IEnumerable Query(string sql, params object[] args)
public IEnumerable Query(string sql, params object[] args)
public IEnumerable Query(string sql, params object[] args)
public List Fetch(Sql sql)
public List Fetch(Sql sql)
public List Fetch(Sql sql)
public IEnumerable Query(Sql sql)
public IEnumerable Query(Sql sql)
public IEnumerable Query(Sql sql)
public IEnumerable Query(Type[] types, object cb, string sql, params object[] args)
#endregion
#region Last Command
public string LastSQL
public object[] LastArgs
public string LastCommand
#endregion
#region FormatCommand
public string FormatCommand(IDbCommand cmd)
public string FormatCommand(string sql, object[] args)
#endregion
#region Public Properties
public IMapper DefaultMapper
public bool EnableAutoSelect;
public bool EnableNamedParams;
public int CommandTimeout;
public int OneTimeCommandTimeout;
public IProvider Provider
public string ConnectionString
public IsolationLevel? IsolationLevel
#endregion
#region Member Fields
// Member variables
private IMapper _defaultMapper;
private string _connectionString;
private IProvider _provider;
private IDbConnection _sharedConnection;
private IDbTransaction _transaction;
private int _sharedConnectionDepth;
private int _transactionDepth;
private bool _transactionCancelled;
private string _lastSql;
private object[] _lastArgs;
private string _paramPrefix;
private DbProviderFactory _factory;
private IsolationLevel? _isolationLevel;
#endregion
#region Internal operations
internal void ExecuteNonQueryHelper(IDbCommand cmd);
internal object ExecuteScalarHelper(IDbCommand cmd);
internal void DoPreExecute(IDbCommand cmd);
#endregion
ORM框架PetaPoco API
标签:clean ltm cut end provider exe time etc tco
原文地址:https://www.cnblogs.com/slwangzi/p/8506508.html