'Calling Methods in Infrastructure Project from Application layer in Clean Architecture C#

I am pretty new to Clean Architecture in C#.

Based on the details my understanding was all the business logic must be in Application Layer and any infrastructure level things (DB Crud operations, Message handlings) must be in infrastructure layer.

So I have started the development, but found there is no dependency with infrastructure layer in application layer. Even why they are saying keep the business logic in application layer and infra operations in that layer.

Without that dependency how can I access the CRUD operations in infra layer.

Also there is dependency with Applicaiton layer in infrastructure layer which is I didnt understand.

Someone please help because I really got stuck with it. I have few methods in my application layer and I need to write the output into DB as well, which I dont know how to implement.

So simple it would be like this based on the description


Application Layer

IMessageBroker.cs

Public class IMessageBroker
{
    Task<int> pushtoqueue(string queue, string message);
}

myservice.cs

public class myservice
{
   public void MyMethod
   {
      //Here I need to call the pushtoqueue method which I dont know
   }
}

Infrastructure Layer

MessageBroker.cs

public class messagebroker :Imessagebroker
{
   public task<int> pushtoqueue(string queue, string message)
   {
     // here the queue pushing code comes
   }
}

DependencyInjection.cs

services.Addscoped<IMessageBroker, MessageBroker>();

Please share your thoughts..

Environment

.NET 6

Azure Function Apps 4.0



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source