This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderingDbContext : DbContext | |
{ | |
public DbSet<Order> Order { get; set; } | |
public DbSet<LineItem> LineItem { get; set; } | |
public OrderingDbContext(DbContextOptions<OrderingDbContext> options) : base(options) | |
{ | |
} | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var ctx = new OrderContext()) | |
{ | |
//Loading Order only | |
Order o = await ctx.Orders.GetAsync(OrderId); | |
//Loads Order LineItems using Lazy Loading | |
var orderItems = o.LineItems; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Order | |
{ | |
public Guid CustomerId { get; private set; } | |
public string OrderNo { get; private set; } | |
public DateTime DatePlaced { get; private set; } | |
public DateTime? DatePaid { get; private set; } | |
public decimal OrderTotal { get; private set; } | |
public decimal TotalVat { get; private set; } | |
public int? ShippingType { get; private set; } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddDefaultEndpoint<ICustomerService>("customer-service"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void AddDefaultEndpoint<T>(this IServiceCollection services, string serviceName) where T : class | |
{ | |
var clientName = typeof(T).ToString(); | |
var options = ConfigureOptions(services); | |
ConfigureDefaultClient(services, clientName, serviceName, options); | |
ConfigureForwarder<T>(services, clientName); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var customerService = RestClient.For<ICustomerService> ("https://customers-service.com"); | |
var user = await customerService.GetCustomer(bafb92f7-a2b0-49e6-87c9-f2bd9c5601cb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MedPark.API.Gateway.Messages.Commands; | |
using MedPark.API.Gateway.Models; | |
using Microsoft.AspNetCore.Mvc; | |
using RestEase; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace MedPark.API.Gateway.Services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "node-project-starter", | |
"version": "1.0.0", | |
"description": "Generate nodeJs projects from a list of templates", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Gerade Geldenhuys", | |
"license": "ISC", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs-extra'); | |
module.exports = { | |
generate: function (template, projectName){ | |
fs.mkdirs('./' + projectName + '', function (error) { | |
if(error) | |
console.log(error); | |
else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inquirer = require('inquirer'); | |
var fs = require('fs-extra'); | |
var generator = require('./generator') | |
var availTemplates = fs.readdirSync(__dirname + '/templates'); | |
var questions = [ | |
{ | |
name: "template", | |
type: "list", |