How to Delete Data
EXPERIENCE MANAGEMENT > DATA
There are two overloaded Delete methods to permanently delete data in the Storage. Before deleting existing data items, you need to get their instances (for example, by querying the data store).
To delete a data item from the Data store:
|
1.
|
Connect to the data system. |
using (DataConnection connection = new DataConnection())
{
Demo.Users myUser =
(from d in connection.Get<Demo.Users>()
where d.Name == "John Doe"
select d).First();
connection.Delete<Demo.Users>(myUser);
} Deleting Multiple Data Items
To delete multiple data items from the Data store:
| 1. | Connect to the data system. |
| 3. | Delete the items in the list. |
using (DataConnection connection = new DataConnection())
{
var myUsers = connection.Get<Demo.Users>().Where (d => d.Number > 15).ToList();
connection.Delete<Demo.Users>(myUsers);
}