示例#1
0
        static void Main(string[] args)
        {
            /*
             *      Initialize Console
             */
            System.Console.ForegroundColor = ConsoleColor.Yellow;
            System.Console.WriteLine("**********************************");
            System.Console.WriteLine("BUS PUBLISHER FOR MVC");
            System.Console.WriteLine("**********************************");
            System.Console.ForegroundColor = ConsoleColor.White;

            /*
             *      Initialize Publisher Bus
             */
            var bus = CreateBus();

            System.Console.WriteLine("Please Enter a string ... [CTRL+C to quit]");

            /*
             *      Create Messages and send
             *      Endpoint is configured inside app.config for flexibility
             */
            while (true)
            {
                var content    = System.Console.ReadLine();
                var mvcMessage = MvcMessage.Create(content);
                bus.Send(mvcMessage);
            }
        }
    public void Reroute(Type newEntityType)
    {
        MvcMessage reroutedMessage = (MvcMessage)MemberwiseClone();

        reroutedMessage.EntityType = newEntityType;
        Controller.NotifyAll(reroutedMessage);
    }