0
kansoftware created
Prerequisites
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- What is your product version? 8.1
- What is your product type (Angular or MVC)? MVC
- What is product framework type (.net framework or .net core)? > netcore
If issue related with ABP Framework
4 Answer(s)
-
0
You can also refer to the project we shared earlier in that version it was working fine.
-
0
Can you please the base class of
StoredProcedureCalling
? -
0
-
0
Hi Kansoftware,
I am upgrading from 6.80 to 10.4.0 and found I had to make the following changes to my SQLRepository:
... code removed for brevity /// <summary> /// Returns a list of abpUsers with links to entities in nuagecare /// </summary> /// <param name="tenantId">long</param> /// <param name="UserId">long</param> /// <param name="isDeleted">bool?</param> /// <returns>Task<IQueryable<GetStaffForKendoGrid_Result>></returns> public async Task<IQueryable<GetStaffForKendoGrid_Result>> GetStaffForKendoGrid(int tenantId, long userId, bool isDeleted) { await **EnsureConnectionOpen();** var parms = new SqlParameter[3]; parms[0] = new SqlParameter("@TenantId", tenantId); parms[1] = new SqlParameter("@UserId", userId); parms[2] = new SqlParameter("@IsDeleted", isDeleted); using (var command =** CreateCommand("GetStaffForKendoGrid", CommandType.StoredProcedure, parms)**) { using (var dataReader = await command.ExecuteReaderAsync()) { var result = new List<GetStaffForKendoGrid_Result>(); while (dataReader.Read()) { var model = new GetStaffForKendoGrid_Result(); ... model population here result.Add(model); } dataReader.Close(); return result.AsQueryable(); } } } .... #region helper methods /// <summary> /// /// </summary> /// <param name = "commandText" ></param > /// < param name="commandType"></param> /// <param name = "parameters" ></param > /// < returns ></returns > DbCommand CreateCommand(string commandText, CommandType commandType, params SqlParameter[] parameters) { var command = **GetConnection().CreateCommand();** command.CommandText = commandText; command.CommandType = commandType; command.Transaction = GetActiveTransaction(); foreach (var parameter in parameters) { command.Parameters.Add(parameter); } return command; } /// <summary> /// Opens an SQL connection if one does not already exist. /// 20191020 - changed to OpenAsync() /// </summary> async Task EnsureConnectionOpen() { var connection = GetConnection(); if (connection.State != ConnectionState.Open) { await connection.OpenAsync(); } } /// <summary> /// /// </summary> /// <returns></returns> DbTransaction GetActiveTransaction() { return (DbTransaction)_transactionProvider.GetActiveTransaction(new ActiveTransactionProviderArgs { {"ContextType", typeof(NuagecareDbContext) }, {"MultiTenancySide", MultiTenancySide } }); } #endregion helper methods
I also had to change my using statement from;
using System.Data.SqlClient;
tousing Microsoft.Data.SqlClient;
But I think that's more down to the fact that I was previously on aspnet framework 4.6.0 with donetcore 2.1.Hope that helps.