C# querying the EWS Managed API from as asp.net core web api
Let see how we can integrate the Microsoft Exchange (AKA EWS) and access the information.
Let see how we can integrate the Microsoft Exchange (AKA EWS) and access the information.
More often we have to call a RESTfull service, it could be simple as sending an email, SMS, posting a message, etc. We use can use an HttpClient for all our HTTP calls. Alternatively, we can use a library such as Restshaper.
When you use AutoMapper to map our objects, and AutoMapper profiles are the way we do it, it encapsulates a lot of business logic in some cases. But we need to make sure the business logic gets unit tested.
As part of my Mediator handler, I have multiple dependencies injected they are DbContext, IMapper. But remember, as part of the application initialisation we have AutoMapper Profile registration automatically. But it’s not the case with Unit Testing we need to register the dependencies or mock them. Therefore we need to add the Profile to our IMapper initialisation.
Most of the apps we write have some data that not get updated frequently or not get updated at all. For example – suburb list, user roles, etc. We can avoid reading the database for all those entities by using a cached collection.
This quick tutorial will show how we ca register dependencies for Dependency Injection in ASP.NET Core using the built-in container.