public InitializationModel(IStore<Player> playerCollection, IStore<RankingDetail> rankingCollection, IStore<Owner> ownerCollection, IStore<BidDetail> bidCollection)
 {
     _playerCollection = playerCollection.FindAll().ToList();
     _rankingCollection = rankingCollection.FindAll().ToList();
     _ownerCollection = ownerCollection.FindAll().ToList();
     _bidCollection = bidCollection;
 }
Esempio n. 2
0
 public ProjectService(IStore<Project> ps, IStore<Platform> tps, IMappingEngine mapper, ILoggerService log)
 {
     TestProjectStore = ps;
     TestPlatformStore = tps;
     Mapper = mapper;
     Log = log;
 }
Esempio n. 3
0
        public void Add(IStore store, StoreData data)
        {
            var datalist = this.datalist;//GetCacheData();

            if (datalist == null)
            {
                return;
            }

            StoreDataEntity entity = new StoreDataEntity
            {
                Store = store
                ,
                Data = data
            };

            string dk = GetDataKey(data.Type, data.Key);

            datalist.AddOrUpdate(dk, entity, (string k, StoreDataEntity oldData) =>
            {
                return entity;
            });

            if (datalist.Count >= this.capacity)
            {
                ThreadPool.QueueUserWorkItem(SaveAsync, null);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// use this ctor when creating a disconnected store from existing encoded/disconnected data
 /// </summary>
 /// <param name="storeData"></param>
 /// <param name="storeDecodingStrategy"></param>
 public DisconnectedStore(string storeData, Func<string, string> storeDecodingStrategy)
 {
     Condition.Requires(storeData).IsNotNullOrEmpty();
     this._data = storeData;
     this._store = StoreSerializer.DecodeAndDeserializeStoreData(this._data, storeDecodingStrategy);
     
 }
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IStore store, INavigationService nav)
        {
            this.store = store;
            this.nav = nav;

            this.Groups = new ObservableCollection<Group>();
        }
        public MessagingModule(Config cfg, IStore store)
            : base("/Admin/Messaging")
        {
            Get["/"] = _ => View["Admin/Messaging/Index"];
            Get["/Messages"] = _ => Response.AsJson(new { store.Messages });
            Get["/Message/{message}/"] = _ =>
            {
                Type t = store.ResolveMessageType(_.message);
                string kind = "other";
                if (typeof(Neva.Messaging.IQuery).IsAssignableFrom(t)) kind = "Query";
                if (typeof(Neva.Messaging.ICommand).IsAssignableFrom(t)) kind = "Command";
                if (typeof(Neva.Messaging.IEvent).IsAssignableFrom(t)) kind = "Event";

                return Response.AsJson(new
                {
                    Name = _.message,
                    Kind = kind,
                    Properties = t.GetProperties().Select(p => new
                    {
                        p.Name,
                        p.PropertyType,
                        IsXml = p.GetCustomAttributes(typeof(XmlAttribute), false).Length > 0
                    })
                });
            };
        }
Esempio n. 7
0
		public StoreInfoPage(IStore store, ContentMode mode = ContentMode.View)
		{
			//Setup view model
			this.ViewModel = MvxToolbox.LoadViewModel<StoreInfoViewModel>();
			this.ViewModel.Store = store;
			this.ViewModel.Mode = mode;

			InitializeComponent();

			//Setup Header
			this.HeaderView.BindingContext = this.ViewModel;

			//Setup events
			this.listView.ItemSelected += itemSelected;
			this.ViewModel.Products.ReloadFinished += (sender, e) =>
			{
				this.listView.EndRefresh();
			};

			//Setup view model actions
			this.ViewModel.ShowStoreDetailsAction = async (s) =>
			{
				await this.Navigation.PushAsync(new StoreDetailsPage(s, mode));
			};

			this.ViewModel.AddProductAction = async (p, s) =>
			{
				await this.Navigation.PushModalAsync(new NavigationPage(new SaveProductPage(p, s)));
			};
		}
Esempio n. 8
0
 public StreamJournalWriter(IStore storage, EngineConfiguration config)
 {
     _config = config;
     _storage = storage;
     _journalFormatter = config.CreateFormatter(FormatterUsage.Journal);
     _rolloverStrategy = _config.CreateRolloverStrategy();
 }
        /// <summary>
        /// ctor.  requires IStore to wrap
        /// </summary>
        /// <param name="decorated"></param>
        public InterceptingStoreDecoration(IStore decorated, ILogger logger)
            : base(decorated)
        {
            this.Logger = logger;

            //init the intercept chains, wrapping them around the core operations
            this.CommitOperationIntercept = new InterceptChain<ICommitBag, Nothing>((bag) =>
            {
                this.Decorated.Commit(bag);
                return Nothing.VOID;
            });
            this.CommitOperationIntercept.Completed += CommitOperationIntercept_Completed;

            this.GetOperationIntercept = new InterceptChain<IStoredObjectId, IHasId>((x) =>
            {
                return this.Decorated.Get(x);
            });
            this.GetOperationIntercept.Completed += GetOperationIntercept_Completed;

            this.GetAllOperationIntercept = new InterceptChain<Nothing, List<IHasId>>((x) =>
            {
                return this.Decorated.GetAll();
            });
            this.GetAllOperationIntercept.Completed += GetAllOperationIntercept_Completed;
            
            this.SearchOperationIntercept = new InterceptChain<LogicOfTo<IHasId,bool>, List<IHasId>>((x) =>
            {
                return this.Decorated.Search(x);
            });
            this.SearchOperationIntercept.Completed += SearchOperationIntercept_Completed;
        }
Esempio n. 10
0
 public StoreDetail(IStore s)
 {
     Id = s.Id;
     SizeLimit = s.SizeLimit;
     CurrentSize = s.CurrentSize;
     Label = s.Label;
 }
 public ReducedContentHandler(IRRConfiguration config, IHostingEnvironmentWrapper hostingEnvironment, IUriBuilder uriBuilder, IStore store)
 {
     this.config = config;
     this.hostingEnvironment = hostingEnvironment;
     this.uriBuilder = uriBuilder;
     this.store = store;
 }
Esempio n. 12
0
File: IfNode.cs Progetto: r3c/cottle
        public bool Render(IStore store, TextWriter output, out Value result)
        {
            bool	halt;

            foreach (KeyValuePair<IEvaluator, INode> branch in this.branches)
            {
                if (branch.Key.Evaluate (store, output).AsBoolean)
                {
                    store.Enter ();

                    halt = branch.Value.Render (store, output, out result);

                    store.Leave ();

                    return halt;
                }
            }

            if (this.fallback != null)
            {
                store.Enter ();

                halt = this.fallback.Render (store, output, out result);

                store.Leave ();

                return halt;
            }

            result = VoidValue.Instance;

            return false;
        }
        public HomeController(IStore store)
            : base("/")
        {

            Get["/{aggregate:guid}"] = parameters =>
            {
                dynamic events = new ExpandoObject();

                try
                {
                    events.Result = store.GetEventsForAggregate(Guid.Parse(parameters.aggregate)).ToList<Event>();
                }
                catch (AggregateNotFound ex)
                {
                    events.Error = ex.GetType();
                    events.StatuCode = 404;
                    events.Message = ex.Message;
                }
                catch (Exception ex)
                {
                    events.Error = ex.GetType();
                    events.StatuCode = 500;
                    events.Message = ex.Message;
                }

                return events;
            };

            Post["/{aggregate:guid}"] = _ =>
            {
                var eventList = this.Bind<RequestList>();
                return 200;
            };
        }
Esempio n. 14
0
    public override void OnHandle(IStore store,
                                  string collection,
                                  JObject command,
                                  JObject document)
    {
      IObjectStore st = store.GetCollection(collection);

      if (document.Type == JTokenType.Array)
      {
        var documents = document.Values();
        if (documents != null)
          foreach (JObject d in documents)
          {
            var k = d.Property(DocumentMetadata.IdPropertyName);
            if (k != null)
              st.Set((string)k, d);
          }

      }
      else
      {
        var k = document.Property(DocumentMetadata.IdPropertyName);
        if (k != null)
          st.Set((string)k, document);
      }
    }
Esempio n. 15
0
 /// <summary>
 /// copies items between stores
 /// </summary>
 /// <param name="store"></param>
 /// <param name="storeToMoveTo"></param>
 /// <param name="itemsToMove"></param>
 public static void CopyItems(this IStore store, IStore storeToMoveTo, List<StoredObjectId> itemsToMove)
 {
     itemsToMove.WithEach(x =>
     {
         CopyItem(store, storeToMoveTo, x);
     });
 }
Esempio n. 16
0
        /// <summary>
        /// Creates a new store management window.
        /// </summary>
        /// <param name="store">The <see cref="IStore"/> to manage.</param>
        /// <param name="feedCache">Information about implementations found in the <paramref name="store"/> are extracted from here.</param>
        public StoreManageForm([NotNull] IStore store, [NotNull] IFeedCache feedCache)
        {
            #region Sanity checks
            if (store == null) throw new ArgumentNullException("store");
            if (feedCache == null) throw new ArgumentNullException("feedCache");
            #endregion

            _store = store;
            _feedCache = feedCache;

            InitializeComponent();
            buttonRunAsAdmin.AddShieldIcon();

            HandleCreated += delegate
            {
                Program.ConfigureTaskbar(this, Text, subCommand: ".Store.Manage", arguments: StoreMan.Name + " manage");
                if (Locations.IsPortable) Text += @" - " + Resources.PortableMode;
                if (WindowsUtils.IsAdministrator) Text += @" (Administrator)";
                else if (WindowsUtils.IsWindowsNT) buttonRunAsAdmin.Visible = true;
            };

            Shown += delegate { RefreshList(); };

            _treeView.SelectedEntryChanged += OnSelectedEntryChanged;
            _treeView.CheckedEntriesChanged += OnCheckedEntriesChanged;
            splitContainer.Panel1.Controls.Add(_treeView);
        }
Esempio n. 17
0
 /// <summary>
 /// Process USSD requests. Automatically routes to nested routes.
 /// </summary>
 /// <param name="store">Session store</param>
 /// <param name="request"></param>
 /// <param name="initiationController">Initiation controller</param>
 /// <param name="initiationAction">Initiation action</param>
 /// <param name="data">Data available to controllers</param>
 /// <param name="loggingStore">Logging store</param>
 /// <param name="arbitraryLogData">Arbitrary data to add to session log</param>
 /// <returns></returns>
 public static async Task<UssdResponse> Process(IStore store, UssdRequest request,
     string initiationController, string initiationAction,
     Dictionary<string, string> data = null, ILoggingStore loggingStore = null, string arbitraryLogData = null)
 {
     return
             await
                 ProcessRequest(store, request, initiationController, initiationAction, data, loggingStore,
                     arbitraryLogData);
     // TODO: auto process sub dial
     //var messages = GetInitiationMessages(request);
     //if (messages == null)
     //{
     //    return
     //        await
     //            ProcessRequest(store, request, initiationController, initiationAction, data, loggingStore,
     //                arbitraryLogData);
     //}
     //UssdResponse response = null;
     //for (int i = 0; i < messages.Count; i++)
     //{
     //    request.Message = messages[i];
     //    if (i != 0) request.Type = UssdRequestTypes.Response.ToString();
     //    bool dispose = (i == messages.Count-1);
     //    response =
     //        await
     //            ProcessRequest(store, request, initiationController, initiationAction, data, loggingStore,
     //                arbitraryLogData, dispose);
     //}
     //return response;
 }
Esempio n. 18
0
        public TableStateStore(IStore store)
        {
            if (store == null)
                throw new ArgumentNullException("store");

            Store = store;
        }
Esempio n. 19
0
        public Transaction(Session session)
        {
            this.session = session;

            if (session.Workspace is IStorable)
                this.store = ((IStorable)session.Workspace).Store;
        }
Esempio n. 20
0
        // A method that handles densodb events MUST have this delegate.
        public static void Set(IStore dbstore, BSonDoc command)
        {
            // IStore interface gives you a lowlevel access to DB Structure,
              // Every action you take now will jump directly into DB without any event dispatching

              // The Istore is preloaded from densodb, and you should not have access to densodb internals.

              // Now deserialize message from Bson object.
              // should be faster using BsonObject directly but this way is more clear.
              var message = command.FromBSon<Message>();

              // Get the sender UserProfile
              var userprofile = dbstore.GetCollection("users").Where(d => d["UserName"].ToString() == message.From).FirstOrDefault().FromBSon<UserProfile>();

              if (userprofile != null)
              {
            // add message to user's messages
            var profilemessages = dbstore.GetCollection(string.Format("messages_{0}", userprofile.UserName));
            profilemessages.Set(command);

            // add message to user's wall
            var profilewall = dbstore.GetCollection(string.Format("wall_{0}", userprofile.UserName));
            profilewall.Set(command);

            // Now i have user's follower.
            foreach (var follower in userprofile.FollowedBy)
            {
              // Get followers's wall
              var followerwall = dbstore.GetCollection(string.Format("wall_{0}", follower));

              // store the messages in follower's wall.
              followerwall.Set(command);
            }
              }
        }
Esempio n. 21
0
 public UssdContext(IStore store, UssdRequest request, Dictionary<string, string> data)
 {
     Store = store;
     Request = request;
     Data = data;
     DataBag = new UssdDataBag(Store, DataBagKey);
 }
Esempio n. 22
0
 public void Setup()
 {
     _db = new JsonStore<EventDescriptor>();
       _db.DeleteAll();
       _serializer= new JsonSerializer();
       _sut = new Store( _db, _serializer);
 }
 public ProjectVersionService(IStore<Project> projectStore, IStore<ProjectVersion> projectVersionStore, IMappingEngine mapper, ILoggerService log)
 {
     ProjectStore = projectStore;
     ProjectVersionStore = projectVersionStore;
     Mapper = mapper;
     Log = log;
 }
Esempio n. 24
0
 public FixedRecordList(IStore store, int elementSize)
 {
     this.store = store;
     this.elementSize = elementSize;
     blockElements = new long[64];
     blockAreas = new IArea[64];
 }
        // If you care for what's inside your TInitializer model,
        // add the parameter to the ctor of the view.
        // Compare to ListViewModel - where we're not interested in the model.
        public DetailViewModel(IStore store, ShowCustomerDetails args)
        {
            _store = store;

            var c = _store.LoadCustomer(args.CustomerId);
            Console.WriteLine("Customer details: {0}, {1}", c.Name, c.Birthday);
        }
Esempio n. 26
0
 public DevFrame(IStore<TimeMachineState> store)
 {
     var timeMachineView = new TimeMachine();
     timeMachineView.TimeMachineStore = store;
     Content = timeMachineView;
     BackgroundColor = Color.FromRgb(245, 245, 245);
 }
Esempio n. 27
0
        public bool Render(IStore store, TextWriter output, out Value result)
        {
            output.Write (this.text);

            result = VoidValue.Instance;

            return false;
        }
Esempio n. 28
0
        /// <summary>
        /// Creates a new executor.
        /// </summary>
        /// <param name="store">Used to locate the selected <see cref="Implementation"/>s.</param>
        public Executor([NotNull] IStore store)
        {
            #region Sanity checks
            if (store == null) throw new ArgumentNullException(nameof(store));
            #endregion

            _store = store;
        }
Esempio n. 29
0
 public SqlServerStore(IUriBuilder uriBuilder, IFileRepository repository, IStore fileStore, IReductionRepository reductionRepository)
 {
     RRTracer.Trace("Sql Server Store Created.");
     this.uriBuilder = uriBuilder;
     this.repository = repository;
     this.fileStore = fileStore;
     this.reductionRepository = reductionRepository;
 }
Esempio n. 30
0
        public override IDecorationOf<IStore> ApplyThisDecorationTo(IStore store)
        {
            var returnValue = new PollingStoreDecoration(store);
            if (this.BackgroundHost != null)
                returnValue.SetBackgroundAction(this.BackgroundStrategy, this.BackgroundHost.BackgroundIntervalMSecs);

            return returnValue;
        }
        private async Task Init(IStore <RootState> store)
        {
            await store.Dispatch <FetchProfiles>();

            await store.Dispatch <FetchReportDescriptors>();
        }
 public void TestSetUp()
 {
     storage = new AccountsManager();
 }
 /// <summary>
 /// Called when a conversation is first initiated.
 /// <see cref="ContinueConversationAsync(IStore, ActivityRequest, T)"/> is not called until subsequent replies by the bot user.
 /// </summary>
 /// <param name="store">The persistent store to save conversations in</param>
 /// <param name="request">The first request from the user to start the conversation.</param>
 /// <returns>A <see cref="ConversationResponse{T}"/> defining what conversation context to save and what specific response to return.</returns>
 protected abstract Task <ConversationResponse <T> > StartConversationAsync(IStore store, ActivityRequest request);
Esempio n. 34
0
 //Constructor
 public ProductService(IStore <Product> store, IMapper mapper, IStore <ProductOption> optionStore)
 {
     _store       = store;
     _optionStore = optionStore;
     _mapper      = mapper;
 }
Esempio n. 35
0
 public CommentService(IMapper mapper, IStore <Comment, string> store) : base(mapper, store)
 {
 }
 public ToggleMenuHandler(IStore aStore) : base(aStore)
 {
 }
Esempio n. 37
0
        protected BackupHandlerWithStore(IStore <Guid> store)
        {
            Guard.NotNull(store, nameof(store));

            this.store = store;
        }
Esempio n. 38
0
 public FetchWeatherForecastsHandler(IStore aStore, HttpClient aHttpClient) : base(aStore)
 {
     HttpClient = aHttpClient;
 }
Esempio n. 39
0
 /// <see cref="IMiddleware.Initialize(IStore)"/>
 public virtual void Initialize(IStore store) => Store = store;
Esempio n. 40
0
 public FetchTransactionsHandler(IStore aStore, HttpClient aHttpClient) : base(aStore)
 {
     HttpClient = aHttpClient;
 }
Esempio n. 41
0
 public MyDomainObject(IStore <DomainId> store)
     : base(store, A.Dummy <ISemanticLog>())
 {
 }
 public CloneStateBehaviorTests(TestFixture aTestFixture)
 {
     ServiceProvider = aTestFixture.ServiceProvider;
     Mediator        = ServiceProvider.GetService <IMediator>();
     Store           = ServiceProvider.GetService <IStore>();
 }
Esempio n. 43
0
 /// <summary>
 /// 初始化一个<see cref="TreeServiceBase{TEntity,TDto,TQueryParameter}"/>类型的实例
 /// </summary>
 /// <param name="unitOfWork">工作单元</param>
 /// <param name="store">存储器</param>
 protected TreeServiceBase(IUnitOfWork unitOfWork, IStore <TEntity, Guid> store) : base(unitOfWork, store)
 {
     _store = store;
 }
 public StoreController(IStore userrepo)
 {
     _userrepo = userrepo;
 }
 public BrightstarQueryProcessor(IStore store, ISparqlDataset data) : base(data)
 {
     //_store = store;
 }
Esempio n. 46
0
        public static bool Contains(this IStore store, StoredObjectId soId)
        {
            var item = store.Get(soId);

            return(item != null);
        }
Esempio n. 47
0
 public SendHandler(IStore aStore, IMediator aMediator) : base(aStore)
 {
     Mediator = aMediator;
 }
Esempio n. 48
0
 public GetOMWStatsHandler(IStore aStore, E1Service e1Service) : base(aStore)
 {
     E1Service = e1Service;
 }
 /// <summary>
 /// Called when a conversation continues.
 /// </summary>
 /// <param name="store">The persistent store to save conversations in</param>
 /// <param name="request">The first request from the user to start the conversation.</param>
 /// <param name="priorConversation">The prior conversation saved.</param>
 /// <returns>A <see cref="ConversationResponse{T}"/> defining what conversation context to save and what specific response to return.</returns>
 protected abstract Task <ConversationResponse <T> > ContinueConversationAsync(IStore store, ActivityRequest request, T priorConversation);
Esempio n. 50
0
 public ResetStoreHandler(IStore aStore, ISender aSender)
 {
     Sender = aSender;
     Store  = aStore;
 }
 public override Task InitializeAsync(IStore store) => base.InitializeAsync(store);
        public static IStore RegisterIndexes(this IStore store, Type type)
        {
            var index = Activator.CreateInstance(type) as IIndexProvider;

            return(store.RegisterIndexes(index));
        }
Esempio n. 53
0
 public ChapterImporter(IStore <DbTranslatedChapter> translatedChapters, IStore <DbChapter> chapters, IStore <DbExpression> expressions, IStore <DbWord> words, ITranslate <Guid, TranslatedExpression> exprTranslator, ITranslate <Guid, TranslatedWord> wordTranslator)
 {
     _translatedChapters = translatedChapters;
     _chapters           = chapters;
     _expressions        = expressions;
     _words          = words;
     _exprTranslator = exprTranslator;
     _wordTranslator = wordTranslator;
 }
 public static IStore RegisterIndexes <T>(this IStore store) where T : IIndexProvider
 {
     return(store.RegisterIndexes(typeof(T)));
 }
Esempio n. 55
0
 public FactManager(IStore store)
 {
     this.store = store;
 }
Esempio n. 56
0
 public EventStore(IStore store, IValidatorFactory validationFactory)
 {
     _store             = store;
     _validationFactory = validationFactory;
 }
 private void MapDispatchToProps(IStore <RootState> store, GenerateReportFormProps props)
 {
     props.OnGenerate = EventCallback.Factory.Create <GenerateReportViewModel>(this, r => HandleGenerate(store, r));
 }
Esempio n. 58
0
 public ContextRepositoryBase(IStore store, IMapper mapper)
 {
     this._store  = store;
     this._mapper = mapper;
 }
Esempio n. 59
0
 public void InitializeFixture()
 {
     _fx    = new LiteDBStoreFixture();
     _store = _fx.Store;
 }
Esempio n. 60
0
 public TransactionSet(IStore store)
     : base(store)
 {
 }