Ejemplo n.º 1
0
        public AppContext()
        {
            string storePath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "store.db");

            Type tEvent     = typeof(IEvent);
            Type tTO        = typeof(ITransferObject);
            var  allTypes   = System.Reflection.Assembly.GetExecutingAssembly().GetTypes();
            var  knownTypes = allTypes
                              .Where(t => !t.IsAbstract)
                              .Where(t => t.IsClass || t.IsValueType)
                              .Where(t => tEvent.IsAssignableFrom(t) || tTO.IsAssignableFrom(t)).ToArray();

            JSONFileEventStore store = new JSONFileEventStore(storePath, knownTypes);

            Repository = new Repository(store);
            var bus = MessageBus.Instance;

            AccountProjection = new AccountProjection(store, bus);
            AccountProjection.Init();
            AccountHandler = new Account.Handler(Repository, bus);

            GameProjection = new GameProjection(store, bus);
            GameProjection.Init();
            GameHandler = new BC.Game.Game.Handler(Repository, bus);

            FriendshipProjection = new FriendshipProjection(store, bus);
            FriendshipProjection.Init();
            FriendshipHandler = new Friendship.Handler(Repository, bus);
            //autologout ohne events
            AccountProjection.LogoutAllAccounts();

            GameProjection.CloseGamesAfterChallengeExpires();
        }
Ejemplo n.º 2
0
 public UserController(AccountEntry accountEntry, AccountProjection accountProjection, BC.Game.GameProjection gameProjection, FriendshipProjection friendshipProjection)
 {
     AccountEntry         = accountEntry;
     AccountProjection    = accountProjection;
     GameProjection       = gameProjection;
     FriendshipProjection = friendshipProjection;
 }
Ejemplo n.º 3
0
 public FriendshipController(AccountEntry accountEntry, AccountProjection accountProjection, ChessgameProjection gameProjection,
                             FriendshipProjection friendshipProjection, RootController rootController)
 {
     AccountEntry         = accountEntry;
     AccountProjection    = accountProjection;
     GameProjection       = gameProjection;
     FriendshipProjection = friendshipProjection;
     RenderCurrentcontent = RenderOverview;
 }