none
Micro-services in ASP.NET CORE WEB API RRS feed

  • Question



  • Hi All, 

    I have gone through many of the sites, blogs, videos, tutorials but my doubt isn't clear, please direct me in a simple way.

    When ASP.NET Core web API called microservices what kind of coding pattern follows or coding structure

    If you could provide some code will be great 

    Regards, 

    Alok Singh


    • Edited by Alkaline_16 Thursday, December 27, 2018 2:10 PM
    • Moved by CoolDadTx Thursday, December 27, 2018 6:48 PM ASP.NET related
    Thursday, December 27, 2018 2:07 PM

All replies

  • Hello,

    I think microservice architecture is not about Web API. It is more about whole system dividing into small isolated parts. Communication between these parts is base of microservice architecture. This architecture style cannot be described by one or two patterns. It you have use cases for whole system you can try to find some disjointed areas of system. Each of these areas has own database, own data layer, own business layer and UI (it might be REST API for example). There is necessary to have system for communication. For example if you have product microservice to have business rules above product, you have microservice for invoicing which uses product too. But invoice microservice doesn't have access to product microservice database. So if product price is changed, product microservice fired event and invoice microservice update own records. So there could be some duplicity on code and databases. 

    What I want to say it is that microservice architecture is created by parts which are low coupled together. This is heart of microservices. 

    I think … If you know system functionality and you have use cases you must have some layer which represents these use cases. First step to create microservice architecture is divide this layer into isolated parts and all logic from another part should be called through this layer. Second step is divide and create database for each part and create some communication mechanism as messaging queues, RPC or REST API. 

    Coding structure is not depend on this architecture. Many systems which are not based on microservices have similar architecture - data layer, application layer and business layer. Use only what you need. If you have part where business rules are not present don't implement business layer. 

    Thursday, December 27, 2018 6:11 PM
  • Please post questions related to web development in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, December 27, 2018 6:48 PM