Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryFactoryBase{TQuery}" /> class.
 /// </summary>
 /// <param name="modelFactoryResolver">The model factory resolver.</param>
 /// <param name="defaultModel">The default model.</param>
 protected QueryFactoryBase(
     IModelFactoryResolver modelFactoryResolver,
     IDefaultModel defaultModel)
 {
     this.ModelFactoryResolver = modelFactoryResolver;
     this.DefaultModel         = defaultModel;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModelUpdaterBase{TModel, TMessage}" /> class.
 /// </summary>
 /// <param name="modelFactoryResolver">The model factory resolver.</param>
 protected ModelUpdaterBase(IModelFactoryResolver modelFactoryResolver,
                            IDefaultModel defaultModel)
 {
     this.ModelFactoryResolver = modelFactoryResolver;
     this.DefaultModel         = defaultModel;
     this.Log = LogManager.GetLogger(this.GetType());
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> Index2Async(this IDefaultModel operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.Index2WithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 4
0
        public void Update(IDefaultModel entity)
        {
            var valid = true;

            if (_repository.GetSingle(entity.Id) == null)
            {
                return;
            }

            var validatorTyper = _typer.GetRefTyper("Validator", TyperAction.Update);

            if (validatorTyper != null)
            {
                var validator = _serviceBuilder.GetService(validatorTyper);
                valid = (validator as IValidator).Run(entity);
            }

            if (valid)
            {
                _repository.Update(entity as IDefaultModel);
            }

            return;
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static object Index2(this IDefaultModel operations)
 {
     return(Task.Factory.StartNew(s => ((IDefaultModel)s).Index2Async(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public DialAddedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionTimeQueryFactory" /> class.
 /// </summary>
 /// <param name="modelFactoryResolver">The model factory resolver.</param>
 /// <param name="defaultModel">The default model.</param>
 public SessionTimeQueryFactory(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultModel)
     : base(modelFactoryResolver, defaultModel)
 {
 }
Ejemplo n.º 8
0
 public UserSignInUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
 public UserBoosterPackCountChangedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 10
0
 public DefaultPresenter(IDefaultView view)
 {
     View = view;
     Model = new DefaultModel();
     GoDaddyActions = new GoDaddyActions(view);
 }
Ejemplo n.º 11
0
 public UserAddedMageToInventoryUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 12
0
 public MageKnightQueryFactory(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultModel)
     : base(modelFactoryResolver, defaultModel)
 {
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionTimeChangedUpdater" /> class.
 /// </summary>
 /// <param name="modelFactoryResolver">The model factory resolver.</param>
 public SessionTimeChangedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 14
0
 public MageKnightCoordinatesChangedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 15
0
        private ServiceTypeProvider()
        {
            var modelFactories = new IModelFactory[]
            {
                new SessionTimeFactory(),
                new MageKnightFactory(),
                new UserFactory(),
                new UserCollectionFactory(),
                new GameFactory(),
                new GamesFactory(),
                new DialFactory(),
                new StatFactory(),
                new ClickFactory(),
            };

            this.modelFactoryResolver = new ModelFactoryResolver(modelFactories);
            this.defaultModel         = new DefaultModel.DefaultModel(this.modelFactoryResolver);

            IEnumerable <IQueryFactory> queryFactories;

            queryFactories = new IQueryFactory[]
            {
                new SessionTimeQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new MageKnightQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new UserQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new UserCollectionQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new GameQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new GamesQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new DialQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new ClickQueryFactory(this.modelFactoryResolver, this.defaultModel),
                new StatQueryFactory(this.modelFactoryResolver, this.defaultModel),
            };

            this.queryFactoryResolver = new QueryFactoryResolver(queryFactories);

            var modelUpdaters = new IModelUpdater[]
            {
                new SessionTimeChangedUpdater(this.modelFactoryResolver, this.defaultModel),
                new MageKnightChangedUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserChangedUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserCollectionAddedUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserInventoryAddUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserArmyAddUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserAddedMageToArmyUpdater(this.modelFactoryResolver, this.defaultModel),
                new GameChangedModelUpdater(this.modelFactoryResolver, this.defaultModel),
                new GamesChangedModelUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserSignUpUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserBoosterPackCountChangedUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserSignInUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserIsSignedInChangedUpdater(this.modelFactoryResolver, this.defaultModel),
                new GameJoinedUpdater(this.modelFactoryResolver, this.defaultModel),
                new MageKnightCoordinatesChangedUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserSelectedMageChangedUpdater(this.modelFactoryResolver, this.defaultModel),
                new UserAddedMageToInventoryUpdater(this.modelFactoryResolver, this.defaultModel),
            };

            this.modelUpdaterResolver = new ModelUpdaterResolver(modelUpdaters);

            var serverMessageHandlers = new IServerMessageHandler[]
            {
                new SessionTimeChangedHandler(this.modelUpdaterResolver),
                new MageKnightChangedHandler(this.modelUpdaterResolver),
                new UserChangedHandler(this.modelUpdaterResolver),
                new UserCollectionAddedHandler(this.modelUpdaterResolver),
                new UserInventoryAddHandler(this.modelUpdaterResolver),
                new UserAddedMageToArmyHandler(this.modelUpdaterResolver),
                new UserArmyAddHandler(this.modelUpdaterResolver),
                new GameChangedHandler(this.modelUpdaterResolver),
                new GamesChangedHandler(this.modelUpdaterResolver),
                new UserSignUpHandler(this.modelUpdaterResolver),
                new UserBoosterPackCountChangedHandler(this.modelUpdaterResolver),
                new UserSignInHandler(this.modelUpdaterResolver),
                new UserIsSignedInChangedHandler(this.modelUpdaterResolver),
                new GameJoinedHandler(this.modelUpdaterResolver),
                new MageKnightCoordinatesChangedHandler(this.modelUpdaterResolver),
                new UserSelectedMageChangedHandler(this.modelUpdaterResolver),
                new UserAddedMageToInventoryHandler(this.modelUpdaterResolver),
            };

            var serverMessageHandlerResolver = new ServerMessageHandlerResolver(serverMessageHandlers);

            this.QueryHandlerCollectionFactory = new QueryHandlerCollectionFactory(
                this.queryFactoryResolver,
                serverMessageHandlerResolver);

            this.serviceClient = new Lazy <IServiceClient>(
                this.CreateServiceClient,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.sessionTimeProxyFactory = new Lazy <ISessionTimeProxyFactory>(
                this.CreateSessionTimeProxyFactory,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.sessionTime = new Lazy <ISessionTime>(
                this.CreateSessionTime,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.mageKnightProxyFactory = new Lazy <IMageKnightModelProxyFactory>(
                this.CreateMageKnightProxyFactory,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.mageKnight = new Lazy <IMageKnightModel>(
                this.CreateMageKnight,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.userProxyFactory = new Lazy <IUserModelProxyFactory>(
                this.CreateUserProxyFactory,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.user = new Lazy <IUserModel>(
                this.CreateUser,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.userCollectionProxyFactory = new Lazy <IUserCollectionProxyFactory>(
                this.CreateUserCollectionProxyFactory,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.userCollection = new Lazy <IUserCollection>(
                this.CreateUserCollection,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.gameProxyFactory = new Lazy <IGameModelProxyFactory>(
                this.CreateGameProxyFactory,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.game = new Lazy <IGameModel>(
                this.CreateGame,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.gamesProxyFactory = new Lazy <IGamesModelProxyFactory>(
                this.CreateGamesProxyFactory,
                LazyThreadSafetyMode.ExecutionAndPublication);

            this.games = new Lazy <IGameModels>(
                this.CreateGames,
                LazyThreadSafetyMode.ExecutionAndPublication);
        }
Ejemplo n.º 16
0
 public UserArmyAddUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
 public GamesChangedModelUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 18
0
 public UserCollectionAddedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 19
0
 public UserIsSignedInChangedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 20
0
 public ClickQueryFactory(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultModel)
     : base(modelFactoryResolver, defaultModel)
 {
 }
 public UserCollectionQueryFactory(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultModel)
     : base(modelFactoryResolver, defaultModel)
 {
 }
Ejemplo n.º 22
0
 public GameJoinedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }
Ejemplo n.º 23
0
 public UserSelectedMageChangedUpdater(
     IModelFactoryResolver modelFactoryResolver, IDefaultModel defaultMode)
     : base(modelFactoryResolver, defaultMode)
 {
 }