This file contains hidden or 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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Launch and Debug Standalone Blazor WebAssembly App", | |
"type": "blazorwasm", | |
"request": "launch", | |
"cwd": "${workspaceFolder}/MyBlazorWebAssemblyApp", | |
"url": "http://localhost:5000", | |
"browser": "edge" |
This file contains hidden or 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
void AnimSpawn( Object prefabToSpawn ) | |
{ | |
/// Spawn an effect on the position from node 1 in the animation | |
/// prefabToSpawn is the prefab identified in our Event trigger | |
/// SpriteAnimNodes is a C# class included in Powersprite | |
/// which you add to your creature / character animation | |
Instantiate( | |
prefabToSpawn, | |
GetComponent<SpriteAnimNodes>().GetPosition(1), | |
Quaternion.identity |
This file contains hidden or 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 System.Threading.Tasks; | |
using EncapsulationApi.DDD.DomainModels; | |
using EncapsulationApi.DDD.Repositories; | |
namespace EncapsulationApi.DDD.ApplicationServices | |
{ | |
public class DomainModelApplicationService : IDomainModelApplicationService | |
{ | |
private readonly IDomainModelRepository _domainModelRepository; |
This file contains hidden or 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 atmMachine = new CrappyAtmMachine(); | |
var amountToWithdraw = 20; | |
var curAccount = atmMachine.ThisJerksAccounts.Find(g => g.AccountNumber.Equals(accountId)); | |
if(curAccount != null) | |
{ | |
Console.WriteLine($"I checked my balance on account #{accountId}. The balance is now ${curAccount.Balance}"); | |
if (curAccount.Balance < amountToWithdraw) | |
{ |
This file contains hidden or 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 System.Collections.Generic; | |
using AtmEncapsulationExample.AtmMachines.Good; | |
namespace AtmEncapsulationExample.AtmMachines.Crappy | |
{ | |
/// <summary> | |
/// Our un-encapsulated ATM Machine | |
/// </summary> | |
public class CrappyAtmMachine | |
{ |
This file contains hidden or 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
private static void CallGoodAtmMachine() | |
{ | |
//Call a factory to get back our atm interface implementation | |
var atmMachine = AtmMachineFactory.GetAtmMachine(); | |
atmMachine.Login(5555); | |
var balance = atmMachine.CheckBalance(accountId); | |
Console.WriteLine($"I checked my balance on account #{accountId}. The balance is now ${balance}"); |
This file contains hidden or 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 System.Collections.Generic; | |
using System.Linq; | |
namespace AtmEncapsulationExample.AtmMachines | |
{ | |
/// <summary> | |
/// Our public interface to our ATM Machine | |
/// </summary> | |
public interface IAtmMachine | |
{ |
This file contains hidden or 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
@startuml | |
actor caller order 1 | |
participant API order 2 | |
participant WidgetAppService order 3 | |
participant AuthorisationService order 4 | |
participant WidgetRepository order 5 | |
participant MoreDetailsWidgetRepository order 6 | |
database WidgetDB order 7 | |
boundary MoreDetailsAPI order 8 |
This file contains hidden or 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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Logging; | |
namespace AspNetCore.Conventions.Controllers | |
{ | |
[ApiController] |
This file contains hidden or 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
[HttpGet] | |
[ApiConventionMethod(typeof(DefaultApiConventions), | |
nameof(DefaultApiConventions.Get))] | |
public async Task<ActionResult<IEnumerable<WeatherForecast>>> GetAsync() | |
{ | |
var rng = new Random(); | |
var notFound = false; | |
var response = Enumerable.Range(1, 5).Select(index => new WeatherForecast | |
{ | |
Date = DateTime.Now.AddDays(index), |
NewerOlder