Thanks buddy :-)
Here you go: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/481">https://github.com/aspnetzero/aspnet-zero/issues/481</a>
Thanks Hilal. Once the fix is there, is it possible to just take the fix and apply it to my existing download?
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?
Hi, I got a complaint from my client for the following behavior in the Metronic template (Attached). They use tablets of width ~640.
This snapshot is taken from the online demo that you offer: <a class="postlink" href="http://test4-27490.demo.aspnetzero.com/Application#!/tenant/dashboard">http://test4-27490.demo.aspnetzero.com/ ... /dashboard</a> Username/Password: admin/123456
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
Hi, I am in need to run a query directly on SQL Server. When using Abp, this means I have to create a new repository and add this method inside to call the Stored Procedure using SqlQuery.
My question is, the result I am returning is not and wont be mapped to any entity. Is it possible to return a result from SqlQuery as Dictionary of key/value or DataTable?
I will need then to generate and export Excel out of the data returned.
It happens in my case the data is dynamic. I am generating PIVOT out of data and hence columns are not known ahead of time.
I appreciate your assistance.
Bilal
Thanks :-)
Are you a developer on the framework?