/// <summary> Enumerates get all in this collection. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="fieldToSkip"> (optional) the field to skip. </param> /// /// <returns> An enumerator that allows for each to be used to process get all {TEntity} in this /// collection. </returns> public virtual IEnumerable <TEntity> GetAll <TEntity>(string fieldToSkip = null) where TEntity : new() { //var name = typeof(TEntity).Name; var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); string commandText = string.Format("{0}_GetAll", entityInfo.Name); return(SimpleAccess.ExecuteEntities <TEntity>(commandText, CommandType.StoredProcedure, fieldToSkip)); }
/// <summary> Soft delete the <typeparamref name="TEntity"/> record. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="transaction"> The SQL transaction. </param> /// <param name="id"> The identifier. </param> /// /// <returns> Number of rows affected (integer) </returns> public int SoftDelete <TEntity>(OracleTransaction transaction, long id) where TEntity : class { //var name = typeof(TEntity).Name; var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); var commandText = string.Format("{0}_SoftDelete", entityInfo.Name); return(SimpleAccess.ExecuteNonQuery(transaction, commandText, CommandType.StoredProcedure, new[] { id.ToDataParam("id") })); }
/// <summary> Inserts the given dynamic object as OracleParameter names and values. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="paramObject"> The dynamic object as parameters. </param> /// /// <returns> . </returns> public int Insert <TEntity>(object paramObject) { //var name = typeof(TEntity).Name; var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); string commandText = string.Format("{0}_Insert", entityInfo.Name); return(SimpleAccess.ExecuteNonQuery(commandText, CommandType.StoredProcedure, SimpleAccess.BuildOracleParameters(paramObject))); }
/// <summary> Gets. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="transaction"> The transaction. </param> /// <param name="oracleParameter"> The SQL parameter. </param> /// <param name="fieldToSkip"> (optional) the field to skip. </param> /// /// <returns> . </returns> public TEntity Get <TEntity>(OracleTransaction transaction, OracleParameter oracleParameter, string fieldToSkip = null) where TEntity : class, new() { var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); var commandText = string.Format("{0}_GetById", entityInfo.Name); return(SimpleAccess.ExecuteEntity <TEntity>(transaction, commandText, CommandType.StoredProcedure, fieldToSkip, null, new[] { oracleParameter })); }
/// <summary> Updates the given oracleParameters. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="oracleParameters">Options for controlling the SQL. </param> /// /// <returns> . </returns> public int Update <TEntity>(params OracleParameter[] oracleParameters) where TEntity : class { //var name = typeof(TEntity).Name; var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); var commandText = string.Format("{0}_Update", entityInfo.Name); return(SimpleAccess.ExecuteNonQuery(commandText, CommandType.StoredProcedure, oracleParameters)); }
/// <summary> Gets. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="transaction"> The transaction. </param> /// <param name="paramObject"> The dynamic object as parameters. </param> /// <param name="fieldToSkip"> (optional) the field to skip. </param> /// /// <returns> . </returns> public TEntity Get <TEntity>(OracleTransaction transaction, object paramObject, string fieldToSkip = null) where TEntity : class, new() { //var name = typeof(TEntity).Name; var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); var commandText = string.Format("{0}_GetById", entityInfo.Name); return(SimpleAccess.ExecuteEntity <TEntity>(transaction, commandText, CommandType.StoredProcedure, paramObject, fieldToSkip)); }
//public TEntity Get<TEntity>(long id, string fieldToSkip = null, Dictionary<string, PropertyInfo> piList = null) // where TEntity : new() //{ // return Get<TEntity>(new OracleParameter("@id", id), fieldToSkip, piList); //} /// <summary> Gets. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="id"> The identifier. </param> /// <param name="fieldToSkip"> (optional) the field to skip. </param> /// /// <returns> . </returns> public TEntity Get <TEntity>(long id, string fieldToSkip = null) where TEntity : class, new() { var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); var commandText = string.Format("{0}_GetById", entityInfo.Name); return(SimpleAccess.ExecuteEntity <TEntity>(commandText, CommandType.StoredProcedure, fieldToSkip, null, new OracleParameter("@id", id))); // return Get<TEntity>(new OracleParameter("@id", id), transaction, fieldToSkip); }