innovativeinstitution / MicroRabbit

Microservice with RabbitMQ
28 stars 25 forks source link

Migrations is not working #1

Open soaresdiogo opened 3 years ago

soaresdiogo commented 3 years ago

Hi, I did the download and the migrations is not working is ocurring this error: Could not load assembly 'MicroRabbit.Banking.Data'. Ensure it is referenced by the startup project 'MicroRabbit.Domain.Core'.

soaresdiogo commented 3 years ago

I tried with VsCode and VS2019

WolfgangAmadeusWitcher commented 3 years ago

Same issue here. It's about the EF Core upgrade. There are some workarounds, but I didn't want to change his structure, so I hope he makes an official fix.

And even when you resolve the issue by either introducing the connection string as a magic string into the MicroRabbit.Banking.Data Project and set it as startup project, or simply Removing MicroRabbit.Banking.Data project and making it a folder inside the API and keep the MicroRabbit.Banking.API as your startup project, you will still face the problem about

"Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: MicroRabbit.Domain.Core.Bus.IEventBus Lifetime: Transient ImplementationType: MicroRabbit.Infra.Bus.RabbitMQBus': Unable to resolve service for type 'MediatR.IMediator' while attempting to activate 'MicroRabbit.Infra.Bus.RabbitMQBus'.)"

Therefore, do not forget to comment out the line "services.AddTransient<IEventBus, RabbitMQBus>();" RegistryServices method before running the migrations. Then you will be fine.

soaresdiogo commented 3 years ago

It still isn't working: Could not load assembly 'MicroRabbit.Banking.Data'. Ensure it is referenced by the startup project 'MicroRabbit.Domain.Core'.

And the line there isn't in Startup.cs, I saw in your project services.AddTransient<IEventBus, RabbitMQBus>();

setki commented 3 years ago

Yes, had also some issues. I tried the step-by-step manual and got stuck on the "Add-Migration" part. "Your startup project .... doesn't reference Microsoft.EntityFrameworkCore.Design." It wasn't told so in the video.

Now got it all running again with a SQLExpress.