public List <BaseEntity> GetListEntityByProcedureNameWithParam(string entityName, string procedureName, List <DefinitionStoreProce> listDefinition) { LogTo.Info("RUN STORE ENTITY = {0} IS STORE NAME = {1}", entityName, procedureName); using (var con = EntityManager.Instance.GetConnection(entityName)) using (var sqlCommand = new SqlCommand()) { try { sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = procedureName; sqlCommand.Connection = con; if (listDefinition != null && listDefinition.Count > 0) { foreach (var definitionStoreProce in listDefinition) { ParameterDirection parameterDirection; ParameterDirection.TryParse(definitionStoreProce.ParameterDirection, out parameterDirection); SqlDbType oracleDbType; SqlDbType.TryParse(definitionStoreProce.OracleDbType, out oracleDbType); sqlCommand.Parameters.Add(new SqlParameter(definitionStoreProce.FieldName, oracleDbType, definitionStoreProce.Length, parameterDirection, false, 0, 0, "", DataRowVersion.Proposed, definitionStoreProce.FieldValue)); } } using (var dataReader = sqlCommand.ExecuteReader()) { //Tang so luong doc ban ghi len 100 lan var entity = EntityManager.Instance.GetMyEntity(entityName); return(entity.PopulateBusinessObjectFromReader(dataReader)); } } catch (Exception ex) { LogTo.Error("Loi khi lay du lieu EntityName is {0} and ProcedureName is {1}", entityName, procedureName); LogTo.Error("SQL ERROR:" + sqlCommand.CommandText); throw new Exception("GetListEntitySql::Getall::Error occured.", ex); } } }