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

Activities of "maharatha"

Hi -

I use Okta as my SSO provider and I am able to successfully implement that in my project succesfully. Now other applications wants to call my API and we share the same okta users across.

My question is when the other application is going to call ExternalAuthenticate API of my application how it's going to pass the Tenant ID ? Currently the TenantID is being retrieved from AbpSession.

Do I need to write a separete External Authenticate API and have Tenant ID included as a parameter.

Am I missing something ?

I am currently using two database context to connect to two different MS SQL database. Database 1 : Aspnet Zero database Database 2 - Anothe SQL database where I get and update data

Now I want to add a Third database which is an Oracle database.

I have added the nuget package https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core/ in the EntityFramework.Core project.

After that I am not sure how to proceed.

 public class ThirdDbContextConfigurer
    {
        public static void Configure(DbContextOptionsBuilder<ThirdDbContext> builder, string connectionString)
        {
            
            builder.xxxxxxxx(connectionString);
        }

        public static void Configure(DbContextOptionsBuilder<ThirdDbContext> builder, DbConnection connection)
        {
            builder.xxxxxx(connection);
        }
    }

I was expecting oracle to show up in the builder.XXXXX.

Am i missing something ?

Thank you I completely removed the Automapper from the custiom code. Didn't make any sense to use it .

But this should have been marked as a breaking change

var output = new GetTemplateForEditOutput { Template = ObjectMapper.Map<CreateOrEditTemplateDto>(template) };

This is where it's errroing

I recently updated my ASPNET CORE from V6.7 to 7.0 and I am getting ampping error "

AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.

I am only getting errors for the screens I created using the RAD Tool. This is happening when I am trying to edit the Entity

When I authenticate an user I recieve an accessToken and encryptedAccessToken. What is the difference between these two ?

I am creating a scheduling application where users can select parameters and add a schedule. It could be monthly, Weekly or Daily. I was going through the documentation of Background Job and Background Worker. I believe my need are more of Background Worker and then I came across a note that ABP doesn't support advanced scheduling and use Quartz as an alternative. Then on the Quartz integration page it says to conisder Hangfire as an alternative.

Question :

  1. Can i use Hangfire instead of Quartz to schedule jobs ?
  2. If yes, then how do i create a new Job in Hangfire on the fly and assign a schedule to it

Thank you @ismcagdas. But I am already using a secondary db context to get data. I figured the problem with the dependency Injection.

The last piece i am unable to figure out is the GetActiveTransaction() part.

       public class SecondaryDBDBHelperMethods : ITransientDependency
    {
        private readonly IActiveTransactionProvider _transactionProvider;
        private readonly IDbContextProvider<SecondaryDBDbContext> _SecondaryDBDbContext;

        public SecondaryDBDBHelperMethods(IActiveTransactionProvider transactionProvider, IDbContextProvider<SecondaryDBDbContext> SecondaryDBDbContext)
        {
            _transactionProvider = transactionProvider;
            _SecondaryDBDbContext = SecondaryDBDbContext;
        }

        public async Task<ArrayList> GetStoredProcedureResult(string storedProcedureName, SqlParameter[] parameters)
        {
            EnsureConnectionOpen();
            ArrayList rowList = new ArrayList();

            using (var command = CreateCommand(storedProcedureName, CommandType.StoredProcedure, parameters))
            {
                using (var dataReader = await command.ExecuteReaderAsync())
                {


                    while (dataReader.Read())
                    {
                        object[] values = new object[dataReader.FieldCount];
                        dataReader.GetValues(values);
                        rowList.Add(values);
                    }

                    return rowList;
                }
            }
        }
        private DbCommand CreateCommand(string commandText, CommandType commandType, params SqlParameter[] parameters)
        {
            var command = _SecondaryDBDbContext.GetDbContext().Database.GetDbConnection().CreateCommand();

            command.CommandText = commandText;
            command.CommandType = commandType;
           // command.Transaction = GetActiveTransaction();

            foreach (var parameter in parameters)
            {
                command.Parameters.Add(parameter);
            }

            return command;
        }

        private void EnsureConnectionOpen()
        {
            var connection = _SecondaryDBDbContext.GetDbContext().Database.GetDbConnection();

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }
        }

        private DbTransaction GetActiveTransaction()
        {
            return (DbTransaction)_transactionProvider.GetActiveTransaction(new ActiveTransactionProviderArgs
            {
                {"ContextType", typeof(SecondarybContext) },
                {"MultiTenancySide", MultiTenancySide }

            });
        }
    }

How can i get a ActiveTransaction from the secondary database ? Or do I need to change something

Below is the class I wrote in EFCore :

using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Text;
using System.Threading.Tasks;
using Abp.Data;
using Abp.Dependency;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.EntityFrameworkCore;

namespace YYY.AAA.EntityFrameworkCore
{
    public class xxxxDBHelperMethods : ITransientDependency
    {
        private readonly IActiveTransactionProvider _transactionProvider;
        private readonly xxxxDbContext _xxxxDbContext;

        public xxxxDBHelperMethods(IActiveTransactionProvider transactionProvider, xxxxDbContext xxxxDbContext)
        {
            _transactionProvider = transactionProvider;
            _xxxxDbContext = xxxxDbContext;
        }

        public async Task<ArrayList> GetStoredProcedureResult(string storedProcedureName, SqlParameter[] parameters)
        {
            EnsureConnectionOpen();
            ArrayList rowList = new ArrayList();

            using (var command = CreateCommand(storedProcedureName, CommandType.StoredProcedure, parameters))
            {
                using (var dataReader = await command.ExecuteReaderAsync())
                {


                    while (dataReader.Read())
                    {
                        object[] values = new object[dataReader.FieldCount];
                        dataReader.GetValues(values);
                        rowList.Add(values);
                    }

                    return rowList;
                }
            }
        }
        private DbCommand CreateCommand(string commandText, CommandType commandType, params SqlParameter[] parameters)
        {
            var command = _xxxxDbContext.Database.GetDbConnection().CreateCommand();

            command.CommandText = commandText;
            command.CommandType = commandType;
            command.Transaction = GetActiveTransaction();

            foreach (var parameter in parameters)
            {
                command.Parameters.Add(parameter);
            }

            return command;
        }

        private void EnsureConnectionOpen()
        {
            var connection = _xxxxDbContext.Database.GetDbConnection();

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }
        }

        private DbTransaction GetActiveTransaction()
        {
            return (DbTransaction)_transactionProvider.GetActiveTransaction(new ActiveTransactionProviderArgs
            {
                {"ContextType", typeof(xxxxDbContext) }

            });
        }
    }
}

Below is the class I wrote in my Application Project :

using System.Collections;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;
using System.Threading.Tasks;
using YYY.AAA.EntityFrameworkCore;

namespace YYY.AAA.Reporting
{
    public class ReportingAppServices : AAAAppServiceBase, IReportingAppServices
    {
        private readonly xxxxDBHelperMethods _xxxxDbHelperMethods;

        public ReportingAppServices(xxxxDBHelperMethods xxxxDbHelperMethods)
        {
            _xxxxDbHelperMethods = xxxxDbHelperMethods;

        }

        public Task<ArrayList> GetReportDataFromxxxx(int id)
        {

            SqlParameter param = new SqlParameter { ParameterName = "@id", Value = id, };

            SqlParameter[] parameters = new SqlParameter[1];
            parameters[0] = param;
            return _xxxxDbHelperMethods.GetStoredProcedureResult("[xxxx].[TestStoredProcedure]", parameters);
        }
    }
}

This is a test, and I am getting the below error :

2019-06-27 16:35:27,613 [6 ] Mvc.ExceptionHandling.AbpExceptionFilter - Can't create component 'CASTANDCREW.FMS.EntityFrameworkCore.CAPSPayDbContext' as it has dependencies to be satisfied. 'CASTANDCREW.FMS.EntityFrameworkCore.CAPSPayDbContext' is waiting for the following dependencies:

  • Service 'Microsoft.EntityFrameworkCore.DbContextOptions`1[[CASTANDCREW.FMS.EntityFrameworkCore.CAPSPayDbContext, CASTANDCREW.FMS.EntityFrameworkCore, Version=6.4.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered. Castle.MicroKernel.Handlers.HandlerException: Can't create component 'CASTANDCREW.FMS.EntityFrameworkCore.CAPSPayDbContext' as it has dependencies to be satisfied. 'CASTANDCREW.FMS.EntityFrameworkCore.CAPSPayDbContext' is waiting for the following dependencies:
  • Service 'Microsoft.EntityFrameworkCore.DbContextOptions`1[[CASTANDCREW.FMS.EntityFrameworkCore.CAPSPayDbContext, CASTANDCREW.FMS.EntityFrameworkCore, Version=6.4.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

Is this the rightway to do this ? and why am I getting dependency injection error

I am having the same problem, And I have set Clock.Provider = ClockProviders.Utc; Now I am storing dates which I don't want to be converted and store the data as it is.

In order to do that what I need to do so that it deosn't convert and store the data as it is.

Showing 91 to 100 of 326 entries