Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "bilalhaidar"

Thanks but I'm looking into a link to source code if possible.

Thanks Hilal

Can you please provide me link to code where UOW is done in Abp?

Thanks Ismail, true, repositories are UOW.

But I was confused regarding "using()" the dbContext. Would that close the connection or affect UOW or what happens in this case "using()"?

Can you pls point me your UOW code in Abp? Is it done as an interceptor?

I found something on the internet that I could use inside a custom repository. One concern though that I have is related to DB Connection, would any of the code below break the UOW or so in Abp?

public Dictionary<string, List<object>> GetTableInformation(string tableName, FinkonaDatabaseType type)
{
   var sqlText = "SELECT * from " + tableName;
   DataTable dt = new DataTable();

   // Use DataTables to extract the whole table in one hit
   using(SqlDataAdapter da = new SqlDataAdapter(sqlText, optimumEntities.Database.ConnectionString)
   {
      da.Fill(dt);   
   }

   var tableData = new Dictionary<string, List<object>>();

   // Go through all columns, retrieving their names and populating the rows
   foreach(DataColumn dc in dt.Columns)
   {
      string columnName = dc.Name;
      rowData = new List<object>();
      tableData.Add(columnName, rowData);

      foreach(DataRow dr in dt.Rows)
      {
         rowData.Add(dr[columnName]);   
      }
   }

   return tableData;
}

Another method

DataSet GetDataSet(string sql, CommandType commandType, Dictionary<string, Object> parameters)
    {
        // creates resulting dataset
        var result = new DataSet();

        // creates a data access context (DbContext descendant)
        using (var context = new MyDbContext())
        {
            // creates a Command 
            var cmd = context.Database.Connection.CreateCommand();
            cmd.CommandType = commandType;
            cmd.CommandText = sql;

            // adds all parameters
            foreach (var pr in parameters)
            {
                var p = cmd.CreateParameter();
                p.ParameterName = pr.Key;
                p.Value = pr.Value;
                cmd.Parameters.Add(p);
            }

            try
            {
                // executes
                context.Database.Connection.Open();
                var reader = cmd.ExecuteReader();

                // loop through all resultsets (considering that it's possible to have more than one)
                do
                {
                    // loads the DataTable (schema will be fetch automatically)
                    var tb = new DataTable();
                    tb.Load(reader);
                    result.Tables.Add(tb);

                } while (!reader.IsClosed);
            }
            finally
            {
                // closes the connection
                context.Database.Connection.Close();
            }
        }

        // returns the DataSet
        return result;
    }

Thank you. In my case, it is a bit more involved. I am returning an unknown number of columns from SP. Is there a way to map that result maybe to a DataTable or so?

Thanks

Thanks :-)

Are you a developer on the framework?

Thanks I'll read on.

Can you explain more pls :-)

Ok thanks. I'll try to monitor this error once I move website to domain

Thanks for the explanation but still I don't understand why can't I add properties to Edition class directly?

Showing 191 to 200 of 461 entries