Presentation Script

0. Preset VS solution. It has:

git ch ipc-step0 (before)

Points :

1. Create (code) the IQuotationService in Contracts


public class Quotation
    public DateTime Timestamp { get; set; }
    public decimal BidPrice { get; set; }
    public decimal AskPrice { get; set; }
    public string SecurityCode { get; set; }

git ch ipc-step1 (after)

2. Implement the QuotationService in QuotationModule

class QuotationService : IQuotationService
    private readonly Quotation[] array = 
            new Quotation {AskPrice = 10.50m, BidPrice = 10.55m, SecurityCode = "ING.S.NYSE"},
            new Quotation {AskPrice = 12.50m, BidPrice = 12.55m, SecurityCode = "ING.B.NYSE"},
            new Quotation {AskPrice = 10.70m, BidPrice = 10.75m, SecurityCode = "AAPL.B.NASDAQ"},
            new Quotation {AskPrice = 11.50m, BidPrice = 11.55m, SecurityCode = "AAPL.S.NASDAQ"},
            new Quotation {AskPrice = 16.50m, BidPrice = 16.55m, SecurityCode = "MSFT.B.NASDAQ"},
            new Quotation {AskPrice = 17.50m, BidPrice = 17.55m, SecurityCode = "ING.B.AEX"},
            new Quotation {AskPrice = 10.51m, BidPrice = 10.59m, SecurityCode = "ING.S.AEX"},
    public Quotation[] GetQuotations(string exchange, string instrument, DateTime @from, DateTime to)
        var result = array.Where(q => q.SecurityCode.Contains(exchange));

        if (!string.IsNullOrWhiteSpace(instrument))
            result = result.Where(q => q.SecurityCode.Contains(instrument));

        return result.ToArray();

    public Quotation[] GetQuotations(string securityCode, DateTime @from, DateTime to)
        return array.Where(q => q.SecurityCode == securityCode).ToArray();

git ch ipc-step2 (after)

3. Implement OrderingService in SalesModule


public interface IOrdersService
    void PlaceSellLimitOrder(string securityCode, decimal sellingPrice, DateTime validUntil);
    void PlaceBuyLimitOrder(string securityCode, decimal buyingPrice, DateTime validUntil);
    LimitOrder[] GetLimitOrders();
public class LimitOrder
    public string SecurityCode { get; set; }
    public DateTime PlacedAt { get; set; }
    public OrderType Type { get; set; }
    public decimal Price { get; set; }

    public DateTime ValidUntil { get; set; }

public enum OrderType

git ch ipc-step3 (after)

4. Implement PortfolioService in PortfolioModule


(the point of this demo is not necessarely the communication between BE and FE, which might be done differently from the communication between BE components.However in most cases it is done in the same way, therefore it makes sense to add it in contracts.)

git ch ipc-step4 (after)

5. Introduce iQuarc.AppBoot

git ch ipc-step5 (adds ConsoleUi with IPortfolioService)

6. Bootstrapp iQuarc.AppBoot

git ch ipc-step6 (before)

git ch ipc-step6a (ConsoleUi completed)


7. Implement the ConsoleHost w/ Web API Self Host

git ch ipc-step7 (basic Web API self host)

git ch ipc-step7a (to show below: QuotationService published)

git ch ipc-step7b (to show below)


8. Implement proxies to call the services as a REST API

git ch ipc-step8 (to show below)

git ch ipc-step8a (to show below)

git ch ipc-step8b (before points, to show below)


9. Implement ServicePoxyAttribute and ServiceProxyRegistrationBehavior

git ch ipc-step9 (below points. Start coding, then ch)

public sealed class ServiceProxyRegistrationBehavior : IRegistrationBehavior
    public IEnumerable<ServiceInfo> GetServicesFrom(Type type)
        IEnumerable<ServiceProxyAttribute> attributes = type.GetAttributes<ServiceProxyAttribute>false);
        return attributes.Select(a => new ServiceInfo(a.ExportType, type, string.Empty, ifetime.AlwaysNew));

git ch ipc-step9a (below points)


10. Add the ServiceProxyRegistrationBehavior to ConsoleHost and host each service in its own process

git ch ipc-step10 (below points. Start coding, then ch)