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

Activities of "MellowoodMedical"

Question

Hi,

I am trying to unit test plugin service and getting following error:

Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager was found

Can you please suggest.

Thanks, Gaurav Singh

Answer

Thanks, tests are running now.

Answer

Hi,

Shared project at above mentioned email address.

Thanks, Gaurav Singh

Answer

HI,

Thats right, its invalid connection string error but its failing for in-memory database only for unit test project ("Data Source=":memory:".) We haven't changed any shipped code and only trying to run all unit tests thats come with the project. Can you suggest.

Answer

Hi,

Please find below my comments in bold:

What is your product version? Regular What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? .net core 2.2


StackTrace: System.ArgumentException : Format of the initialization string does not conform to specification starting at index 0. Stack trace: at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary2 parsetable, String connectionString, Boolean buildChain, Dictionary2 synonyms, Boolean firstKey) at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary2 synonyms) at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection() at Microsoft.EntityFrameworkCore.Internal.LazyRef1.get_Value() at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.MoveNext() at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Boolean& found) at lambda_method(Closure ) at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ResultEnumerable1.GetEnumerator() at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider._TrackEntities[TOut,TIn](IEnumerable1 results, QueryContext queryContext, IList1 entityTrackingInfos, IList1 entityAccessors)+MoveNext() at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor1.EnumeratorExceptionInterceptor.MoveNext() at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Boolean& found) at System.Linq.Enumerable.First[TSource](IEnumerable1 source) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass15_11.<CompileQueryCore>b__0(QueryContext qc) at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable1 source, Expression1 predicate) at PatientPortal.Migrations.Seed.Host.DefaultEditionCreator.CreateEditions() in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/src/PatientPortal.EntityFrameworkCore/Migrations/Seed/Host/DefaultEditionCreator.cs:line 26 at PatientPortal.Migrations.Seed.Host.DefaultEditionCreator.Create() in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/src/PatientPortal.EntityFrameworkCore/Migrations/Seed/Host/DefaultEditionCreator.cs:line 21 at PatientPortal.Migrations.Seed.Host.InitialHostDbBuilder.Create() in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/src/PatientPortal.EntityFrameworkCore/Migrations/Seed/Host/InitialHostDbBuilder.cs:line 16 at PatientPortal.Migrations.Seed.SeedHelper.SeedHostDb(PatientPortalDbContext context) in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/src/PatientPortal.EntityFrameworkCore/Migrations/Seed/SeedHelper.cs:line 26 at PatientPortal.Migrations.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action1 contextAction) in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/src/PatientPortal.EntityFrameworkCore/Migrations/Seed/SeedHelper.cs:line 42 at PatientPortal.Migrations.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver) in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/src/PatientPortal.EntityFrameworkCore/Migrations/Seed/SeedHelper.cs:line 18 at PatientPortal.EntityFrameworkCore.PatientPortalEntityFrameworkCoreModule.PostInitialize() in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/src/PatientPortal.EntityFrameworkCore/EntityFrameworkCore/PatientPortalEntityFrameworkCoreModule.cs:line 83 at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.AbpBootstrapper.Initialize() in D:\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:line 155 at Abp.TestBase.AbpIntegratedTestBase`1.InitializeAbp() in D:\Github\aspnetboilerplate\src\Abp.TestBase\TestBase\AbpIntegratedTestBase.cs:line 53 at PatientPortal.Tests.AppTestBase..ctor() in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/test/PatientPortal.Tests/AppTestBase.cs:line 27 at PatientPortal.Tests.Auditing.AuditLogAppService_Tests..ctor() in /Users/gaurav/Documents/Projects/Ideas/PatientPortalV2/test/PatientPortal.Tests/Auditing/AuditLogAppService_Tests.cs:line 21


Question

Hi, all unit tests shipped with aspnet zero project are failing with following exception:

"format of the initialization string does not conform to specification starting at index 0"

Please suggest.

thanks, Gaurav

Got it. Thank you. Woud it be possible to see an example of a service implemented as a plugin module including UI navigation?

Hi, I'm developing a Plugin Module as separate asembly and here is the project structure.

here is the full exception:
Castle.MicroKernel.Handlers.HandlerException
  HResult=0x80131500
  Message=Can't create component 'PatientPortal.PatientStripePayment.StripePatientPaymentAppService' as it has dependencies to be satisfied.

'PatientPortal.PatientStripePayment.StripePatientPaymentAppService' is waiting for the following dependencies:
- Service 'Abp.Domain.Repositories.IRepository`2[[PatientPortal.PatientStripePayment.Entities.Payment, PatientPortal.PatientStripePayment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`2[[PatientPortal.PatientStripePayment.Entities.Invoice, PatientPortal.PatientStripePayment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' which was not registered.

  Source=Castle.Windsor
  StackTrace:
   at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)
   at Abp.Modules.AbpModuleManager.CreateModules(ICollection`1 moduleTypes, List`1 plugInModuleTypes)
   at Abp.Modules.AbpModuleManager.LoadAllModules()
   at Abp.AbpBootstrapper.Initialize()
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(IApplicationBuilder app)
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction)
   at PatientPortal.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\Users\serge\Source\Repos\Ideas Patient Portal v2.0\src\PatientPortal.Web.Host\Startup\Startup.cs:line 154

here is the source code:

using Stripe;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Castle.Core.Logging;
using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.UI;
using Abp.Modules;
using System.Reflection;
using Abp.Zero;

namespace PatientPortal.PatientStripePayment
{
    [DependsOn(typeof(AbpZeroCoreModule))]
    public class StripePatientPaymentAppService : AbpModule, IApplicationService, IStripePatientPaymentAppService
    {
        private readonly IRepository&lt;Entities.PatientPayment, Guid&gt; _paymentRepository;

        private readonly IRepository&lt;Entities.PatientInvoice, Guid&gt; _invoiceRepository;

        public StripePatientPaymentAppService(IRepository&lt;Entities.PatientPayment, Guid&gt; paymentRepository,
            IRepository&lt;Entities.PatientInvoice, Guid&gt; invoiceRepository)
        {
            Logger = NullLogger.Instance;
            _paymentRepository = paymentRepository;
            _invoiceRepository = invoiceRepository;

        }


        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }


        public override void PostInitialize()
        {
            var paymentService = IocManager.Resolve&lt;IStripePatientPaymentAppService&gt;();
        }

        public async Task&lt;string&gt; CreateCharge(long amount, string currency, string invoiceId,
                                                string patientAcuID, string description,
                                                string token, string patientId = "")
        {
            // CheckPermission();
            StripeConfiguration.SetApiKey("sk_test_ktjohPHzIy5vsWJezVIUTq8m");

            var options = new ChargeCreateOptions
            {
                Amount = amount,
                Currency = currency, //"cad"
                Description = description,
                SourceId = token // obtained with Stripe.js,

            };
            var service = new ChargeService();
            Charge charge;
            try
            {
                Logger.Debug(string.Format("Creating Charge of {0} {1} with Stripe ", amount, currency));
                charge = await service.CreateAsync(options);


                var resPayment = await _paymentRepository.InsertAndGetIdAsync(new Entities.PatientPayment()
                {
                    //TODO CreatorUserId = AbpSession.UserId,
                    InvoiceId = invoiceId,
                    Amount = charge.Amount,
                    Currency = charge.Currency,
                    FailureCode = charge.FailureCode,
                    FailureMessage = charge.FailureMessage,
                    Paid = charge.Paid,
                    Status = charge.Status,
                    PatientID = patientId,
                    PatientAcuID = patientAcuID,
                    PaymentId = charge.Id
                });

                Entities.PatientInvoice invoiceUpdate = await _invoiceRepository.FirstOrDefaultAsync(i => i.InvoiceId == invoiceId);
                if (invoiceUpdate != null)
                {
                    invoiceUpdate.PaidDate = charge.Created;
                    var resInvoice = await _invoiceRepository.UpdateAsync(invoiceUpdate);
                }
                else
                {
                    //invoice wasn't found
                    Logger.Warn(string.Format("Payment has been made for invoice {0} PatientId {1} PatientAcuId {2} but the invoice was not found.", invoiceId, patientId, patientAcuID));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
                throw new UserFriendlyException("Stripe Payment call has failed.", ex);
            }


            return charge.Id;
        }

        public async Task&lt;IList&lt;Entities.PatientPayment&gt;> GetPayments()
        {
            return await _paymentRepository.GetAllListAsync(r => r.IsLedgerUpdated == false);
        }

        public async Task ConfirmLedgerUpdate(Guid transactionId)
        {
            var paymentTrx = await _paymentRepository.FirstOrDefaultAsync(r => r.Id == transactionId);
            if (paymentTrx != null && !paymentTrx.IsLedgerUpdated)
            {
                paymentTrx.IsLedgerUpdated = true;
                paymentTrx.LedgerUpdateDate = DateTime.Now;
            }
            else
            {
                throw new UserFriendlyException(string.Format("Transaction  ID {0} was not found or already synced with patient's ledger.", transactionId));
            }

        }


        /// &lt;summary&gt;
        /// g
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;patientId&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;invoiceId&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;invoiceDate&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;debit&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;credit&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;balance&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;currency&quot;&gt;ASCII code of currency symbol &lt;/param&gt;
        /// &lt;returns&gt;&lt;/returns&gt;

        public async Task&lt;Entities.PatientInvoice&gt; CreateInvoice(string patientId, string patientAcuId, string invoiceId, DateTime invoiceDate, double debit, double credit, double balance, int currency)
        {
            Entities.PatientInvoice newInvoice = new Entities.PatientInvoice()
            {
                PatientID = patientId,
                PatientAcuID = patientAcuId,
                InvoiceDate = invoiceDate,
                InvoiceId = invoiceId,
                Debit = debit,
                Credit = credit,
                Balance = balance,
                Currency = currency
            };

            try
            {
                return await _invoiceRepository.InsertAsync(newInvoice);
            }
            catch (Exception ex)
            {

                throw new UserFriendlyException(ex.Message);
            }



        }
        /// &lt;summary&gt;
        /// Updates date,credit, debit,balance of existing invoice. 
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;patientId&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;invoiceId&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;invoiceDate&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;debit&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;credit&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;balance&quot;&gt;&lt;/param&gt;
        /// &lt;returns&gt;&lt;/returns&gt;
        public async Task&lt;Entities.PatientInvoice&gt; UpdateInvoice(string patientId,
                            string invoiceId, DateTime invoiceDate, double debit,
                            double credit, double balance, DateTime paidDate)
        {
            Entities.PatientInvoice existingInvoice = await _invoiceRepository.FirstOrDefaultAsync(r => r.InvoiceId == invoiceId && r.PatientID == patientId);

            if (existingInvoice == null)
                throw new UserFriendlyException(String.Format("No invoice with Id ={0} for patient with Id {1} was found", invoiceId, patientId));

            else
            {
                existingInvoice.InvoiceDate = invoiceDate;
                existingInvoice.Debit = debit;
                existingInvoice.Credit = credit;
                existingInvoice.Balance = balance;
                existingInvoice.PaidDate = paidDate;

                return await _invoiceRepository.UpdateAsync(existingInvoice);
            }
        }
        /// &lt;summary&gt;
        /// Soft deletes an invoice
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;invoiceId&quot;&gt;&lt;/param&gt;
        /// &lt;param name=&quot;patientId&quot;&gt;&lt;/param&gt;
        /// &lt;returns&gt;&lt;/returns&gt;
        public async Task DeleteInvoice(string patientId, string invoiceId)
        {
            var invoice = await _invoiceRepository.FirstOrDefaultAsync(p => p.InvoiceId == invoiceId && p.PatientID == patientId);

            if (invoice != null && !invoice.IsDeleted)
                await _invoiceRepository.DeleteAsync(invoice.Id);
            else
            {
                new UserFriendlyException(String.Format("No invoice with Id ={0} for patient with Id {1} was found", invoiceId, patientId));
            }

        }

        /// &lt;summary&gt;
        /// Gets all unpaid invoices for a patient
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;patientId&quot;&gt;&lt;/param&gt;
        /// &lt;returns&gt;&lt;/returns&gt;
        public async Task&lt;IList&lt;Entities.PatientInvoice&gt;> GetInvoices(string patientId)
        {

            return await _invoiceRepository.GetAllListAsync(r => r.PatientID == patientId
                                                                && r.PaidDate <= DateTime.MinValue
                                                                && r.IsDeleted == false);


        }


    }
}

HI, I am working on .NET visual studio 2019 (.net core 2.2) and I am trying to use Asp.Net Zero Power tools extension but its says it is unavailable for the .net framework 2.2. Is there any work around for it and when can we be it avaiable for the latest .net core framework. It would boost our development l if we can use it in our project.

Thanks

Showing 81 to 89 of 89 entries