Skip to main content

Posts

Showing posts with the label adaugare

Operatii CRUD pe tables in Windows Azure

Se da obiectul de tip Point, cu doua propietati de tip int X si Y si un id tot de tip int, unde point implementeaza TableServiceEntity . Initalizare : //Initializare cont (se poate incarca din fisierul de configurare). StorageAccountInfo account = ... TableStorage tableStorage = TableStorage.Create(account); //Creare tabel cu un anumit nume. tableStorage.TryCreateTable("Point"); Salvare : Point point = new Point(); ... TableStorageDataServiceContext context = table.GetDataServiceContext(); context.AddObject(point); //Doar pe save se salveaza in tabel obiectul nostru. context.Save(); Interogare : TableStorageDataServiceContext context = table.GetDataServiceContext(); //Trebuie specificat numele tabelului. Un tabel poate sa contina orice tip de obiecte, chiar si de tipuri diferite. var query = context .CreateQuery("Point").Where(item => item.Id == 10); IEnumerable resultList = new TableStorageDataServiceQuery((DataServiceQuery)query).ExecuteAll(); Stergere : //Dupa...