Beispiel #1
0
 public IEnumerable <FundsDriverEntity> Execute(GetAllFundsDriversCriterion criterion)
 {
     return(DbContext.Set <FundsDriverEntity>()
            .Include("Incrementors")
            .Include("CustomRule")
            .ToArray());
 }
Beispiel #2
0
        public Item[] FindAll(GetAllFundsDriversCriterion criterion)
        {
            IMongoCollection <Item> itemCollection = Database.GetCollection <Item>("Item");

            var filter = new BsonDocument();

            if (itemCollection.Find <Item>(filter).Count() == 0)
            {
                Item[] items = new Item[] {
                    new Item()
                    {
                        Id             = 1, Name = "Item", Price = 300, IsUnlocked = true, InitialValue = 100
                        , Incrementors = new Incrementor[] {
                            new Incrementor()
                            {
                                Value = 1, IncrementorType = IncrementorTypeEnum.ValueIncrementor
                            },
                            new Incrementor()
                            {
                                Value = 10, IncrementorType = IncrementorTypeEnum.ValueIncrementor
                            },
                            new Incrementor()
                            {
                                Value = 0, IncrementorType = IncrementorTypeEnum.ValueIncrementor
                            }
                        }
                    }
                };
                itemCollection.InsertMany(items);
            }

            return(itemCollection.Find(filter).SortBy(_ => _.Id).ToList().ToArray());
        }
Beispiel #3
0
 public Item[] FindAll(GetAllFundsDriversCriterion criterion)
 {
     using (var uow = _unitOfWorkFactory.Create())
     {
         var findQuery = uow.BuildQuery();
         return(findQuery.For <IEnumerable <FundsDriverEntity> >()
                .With(criterion)
                .Select(_ => _fundsDriverContractMapper.Map(_))
                .ToArray());
     }
 }
Beispiel #4
0
 public Item[] FindAll(GetAllFundsDriversCriterion criterion)
 {
     if (!File.Exists(Path.Combine("storage", "items", "items.json")))
     {
         return(null);
     }
     // deserialize JSON directly from a file
     using (StreamReader file = File.OpenText(Path.Combine("storage", "items", "items.json")))
     {
         JsonSerializer serializer = new JsonSerializer();
         serializer.TypeNameHandling = TypeNameHandling.Auto;
         return((Item[])serializer.Deserialize(file, typeof(Item[])));
     }
 }