Skip to content

Instantly share code, notes, and snippets.

View ducmeit1's full-sized avatar
:octocat:
Simple is best! Always do every simple!

David Ho ducmeit1

:octocat:
Simple is best! Always do every simple!
View GitHub Profile
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"os"
)
var rootCmd = &cobra.Command{
Use: "zmp3",
version: '2'
services:
customer-api:
container_name: customer-api
build:
context: .
dockerfile: Dockerfile
depends_on:
- mssql
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
WORKDIR /app
COPY --from=build-env /app/Customer.API/out .
"ConnectionStrings": {
"DefaultConnection": "Data Source=localhost;Initial Catalog=CustomerDB;User Id=sa;Password=Demo123456@;"
}
using System;
using System.Threading.Tasks;
using Customer.Domain.Commands;
using Customer.Domain.Dtos;
using Customer.Domain.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace Customer.API.Controllers
{
using System;
using System.Threading.Tasks;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace Customer.API.Controllers
{
[ApiController]
[Route("api/[controller]")]
[Produces("application/json")]
services.AddScoped<ICustomerRepository, CustomerRepository>();
services.AddScoped<ICustomerDxos, CustomerDxos>();
using System;
using System.Threading;
using System.Threading.Tasks;
using Customer.Data.IRepositories;
using Customer.Domain.Events;
using MediatR;
using Microsoft.Extensions.Logging;
namespace Customer.Service.Subcribers
{
using System;
using MediatR;
namespace Customer.Domain.Events
{
public class CustomerCreatedEvent : INotification
{
public Guid CustomerId { get; }
public CustomerCreatedEvent(Guid customerId)
using AutoMapper;
using Customer.Domain.Dtos;
namespace Customer.Service.Dxos
{
public class CustomerDxos : ICustomerDxos
{
private readonly IMapper _mapper;
public CustomerDxos()