Base solution for your next web application

Activities of "wcbalberta"

Disabling UnitOfWork didn't work but your reply prompted me to try TransactionScope.Suppress which ignores the current transaction. TransactionScope.Suppress totally works!

Hello,

I ran into an issue when an OdbcConnection couldn't be opened when the caller is created through Dependency Injection. The error message is: ERROR [58005] [IBM][CLI Driver] SQL0998N Error occurred during transaction or heuristic processing. Reason Code = "16". Subcode = "2-8004D026". SQLSTATE=58005

However, with the same connection string and everything, if the caller is created without Dependency Injection, everything is fine.

// this claimSv is created not through Dependency Injection. This works.
            var claimSv = new EcoAppService();

            // this eCOAppSv is created through Dependency Injection. This doesn't work.
            // Please note that EcoAppService implements IEcoAppService
            var eCOAppSv = Resolve<IEcoAppService>();
            Should.NotThrow(() =>
            {
                var claimant1 = claimSv.GetClaimInfo(new GetClaimInfoInput() { ClaimNumber = "4252525" });
                var claimant2 = eCOAppSv.GetClaimInfo(new GetClaimInfoInput() {ClaimNumber = "4252525"});
            });
// The connection string is to connect to a DB2 database.
            var con = new OdbcConnection(_connString);
            try
            {
                var command = con.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = GetClaimInfoQuery(claimNumber);
                // Fail right here if the caller is created through Dependency Injection.
                con.Open();

Could you please assist to make it work with Dependency Injection?

Thanks,

Showing 1 to 2 of 2 entries