本文整理汇总了C#中Services.getStorageForEntity方法的典型用法代码示例。如果您正苦于以下问题:C# Services.getStorageForEntity方法的具体用法?C# Services.getStorageForEntity怎么用?C# Services.getStorageForEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services.getStorageForEntity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StorageViewModel
public StorageViewModel(Services.IStorageServiceFactory storageServiceFactory)
{
_sampleStorage = storageServiceFactory.getStorageForEntity<DB.Sample>();
_sampleStorage.DeleteAll();
_sampleStorage.Insert(new DB.Sample() { Name = "Granat" } );
_sampleStorage.Insert(new DB.Sample() { Name = "Jablko" } );
_sampleStorage.Insert(new DB.Sample() { Name = "Granat" } );
_sampleStorage.Insert(new DB.Sample() { Name = "Hruska" } );
_sampleStorage.Insert(new DB.Sample() { Name = "Granat" } );
// get all items in DB
string query1 = "SELECT * FROM {0}";
List<DB.Sample> list1 = _sampleStorage.QueryItems(query1, new object[] { _sampleStorage.getTableName() });
OriginalItems = new List<string>();
foreach (DB.Sample sample in list1)
{
OriginalItems.Add(sample.Name);
};
// get items in DB with name = Granat
string query2 = "SELECT * FROM {0} WHERE NAME = \"{1}\"";
List <DB.Sample> list2 = _sampleStorage.QueryItems(query2, new object[] { _sampleStorage.getTableName() , "Granat" });
FilteredItems = new List<string>();
foreach (DB.Sample sample in list2) {
FilteredItems.Add(sample.Name);
};
}