예제 #1
0
        public async System.Threading.Tasks.Task <IEnumerable <Item> > GetAsync()
        {
            //using (var client = new DocumentClient(
            //   new Uri(_config.GetConfiguration("ToDoList_CosmosDB:EndpointUri")),
            //           _config.GetConfiguration("ToDoList_CosmosDB:PrimaryKey")))
            //{
            //    FeedOptions queryOptions =
            //        new FeedOptions { MaxItemCount = -1 };

            //    string database = "ToDoList";
            //    string collection = "Items";
            //    string sSql = "SELECT m.id Id, m.name Name, m.description Description, m.isComplete Completed FROM Items m";

            //    var teste =
            //        client.CreateDocumentQuery<Item>(
            //              UriFactory.CreateDocumentCollectionUri(database, collection), sSql, queryOptions)
            //        .ToList();
            //    return teste;
            //}

            var items = await DocumentDBRepository <Item> .GetItemsAsync(d => d.Id != null);

            return(items.ToList());
        }
예제 #2
0
        public async System.Threading.Tasks.Task <Item> GetAsync(string id)
        {
            var items = await DocumentDBRepository <Item> .GetItemAsync(id);

            return(items);
        }
예제 #3
0
 public ItemRepositorio()
 {
     DocumentDBRepository <Item> .Initialize();
 }