concept data store in category .net

appears as: data store
Microservices in .NET Core, Second Edition

This is an excerpt from Manning's book Microservices in .NET Core, Second Edition.

  • A request to receive and log new stock arrives over HTTP. This might come from another microservice or perhaps from a web page that a foreman uses to register stock arrivals. The responsibility of Receive Stock microservice is to handle such requests by validating the request and correctly registering the new stock in a data store.
  • Figure 1.1. The Receive Stock microservice exposes an API to be used when new stock arrives. Other microservices can call that API as indicated by the arrow. The receive stock microservice is responsible for registering all received stock in a data store.
    ch01 fig 1 horsdal2
    Listing 5.8. GET endpoint to query a user and his/her loyalty point by user ID
    language="sql" linenumbering="unnumbered">namespace LoyaltyProgram.Users
    {
      using System;
      using System.Collections.Generic;
      using Microsoft.AspNetCore.Mvc;
    
      [Route("/users")]
      public class UsersController : Controller
      {
        private static readonly IDictionary<int, LoyaltyProgramUser> RegisteredUsers = new Dictionary<int, LoyaltyProgramUser>();
    
        [HttpGet("{userId:int}")]
        public ActionResult<LoyaltyProgramUser> GetUser(int userId) =>
          RegisteredUsers.ContainsKey(userId)
            ? (ActionResult<LoyaltyProgramUser>) Ok(RegisteredUsers[userId])
            : NotFound();
    
        ...
      }
    }
    Microservices in .NET Core: with examples in Nancy

    This is an excerpt from Manning's book Microservices in .NET Core: with examples in Nancy.

    A microservice owns the data store where it stores the data it needs. This is another consequence of a microservice’s scope being a complete capability. Most business capabilities require some data storage. For instance, a Product Catalog microservice needs some information about each product to be stored. To keep Product Catalog loosely coupled with other microservices, the data store containing the product information is completely owned by the microservice. The Product Catalog microservice decides how and when the product information is stored. As illustrated in figure 1.4, other microservices, such as Shopping Cart, can only access product information through the interface to Product Catalog and never directly from the Product Catalog data store.

    The fact that each microservice owns a data store means you don’t need to use the same database technology for all microservices. You can choose a database technology that’s suited to the data that each microservice needs to store.