PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Code is looping back Why-VBForums
Results 1 to 2 of 2

Thread: Code is looping back Why

  1. #1

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,181

    Code is looping back Why

    i have tried the Below Code which user Dapper ORM and which suppose to gives me back a list<model> T
    what ever the UDP (user defined procedure) returns.
    but is is failing since the code is looping back till the MySQL connection pool exhausts at line
    if (Param == null) {
    // BUG: Code is looping between if(Param == null) and Model = GoAppConnection ...
    Model = GoAppConnection.Query<T>(UDP,commandType:CommandType.StoredProcedure).ToList();
    c# Code:
    1. namespace GoAppLibrary.DataAccess
    2. {
    3.     public class DataExecution
    4.     {
    5.              public List<T> GetData<T>(String UDP, DynamicParameters Param = null)        {
    6.             ///<summary>
    7.             ///the function is re-usable and gets the the out of MySQL db and loads into the Model type T
    8.             ///PARAMS
    9.             ///UDP user defined stored procedure of MySQL
    10.             ///Param DynaminParameter, optional
    11.             ///RETRUN
    12.             ///<list of type Model></list>
    13.             ///
    14.             /// TODO- Bug fix
    15.             /// BUG:
    16.             /// Function failed since Model = GoAppConnection.Query<T>(UDP,commandType:CommandType.StoredProcedure).ToList();
    17.             /// Looping till the MySQL connection pools limit bursts, and finally throwing the exception
    18.             ///</summary>
    19.            
    20.  
    21.  
    22.             if (!globals.GlobalVars.IsConnectionStringInitialized)
    23.             {
    24.                 throw new Exception("Application Connection not initialized");
    25.             }
    26.  
    27.  
    28.             using (IDbConnection GoAppConnection = new MySqlConnection(globals.GlobalVars.GlobalConnectionString))
    29.             {              
    30.  
    31.  
    32.                 try
    33.                 {
    34.                     List<T> Model = new List<T>();
    35.                     if (Param == null)
    36.                     {
    37.                         // BUG: Code is looping between if(Param == null) and Model = GoAppConnection ...
    38.                        Model =  GoAppConnection.Query<T>(UDP,commandType:CommandType.StoredProcedure).ToList();
    39.                     }
    40.                     else
    41.                     {
    42.                         Model = GoAppConnection.Query<T>(UDP, Param, commandType: CommandType.StoredProcedure).ToList();
    43.                     }
    44.  
    45.  
    46.                     return Model;
    47.  
    48.  
    49.                 }
    50.                 catch (Exception Ex)
    51.                 {
    52.                     GoAppLibrary.Display.InformationDisplay.InfoMsg(Ex.Message);
    53.                     return null;
    54.                 }
    55.             }
    56.         }
    57.  
    58.  
    59.     }
    60. }
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  2. #2

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,181

    Re: Code is looping back Why

    and this is how i use it
    c# Code:
    1. private List<MapsModel> Get_MapsModelList()
    2.         {
    3.             DataExecution D = new DataExecution();
    4.             return D.GetData<MapsModel>("m_mapsmodel");
    5.         }
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width