本文整理汇总了C#中DbSet.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# DbSet.ToList方法的具体用法?C# DbSet.ToList怎么用?C# DbSet.ToList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbSet
的用法示例。
在下文中一共展示了DbSet.ToList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadModel
protected void loadModel()
{
context = new OpenPaste.Models.DatabaseContext();
pastes = context.Pastes;
pastes.Load();
listViewPastes.DataSource = pastes.ToList<Models.Paste>();
listViewPastes.DataBind();
}
示例2: UpdateLoaiDanhMuc
/// <summary>
/// Update lại biến Static LoaiDanhMuc
/// </summary>
private void UpdateLoaiDanhMuc(DbSet<Dm_LoaiDanhMuc> db)
{
MvcApplication.ListLoaiDanhMuc = db.ToList();
}
示例3: ReloadDanhMucChung
/// <summary>
/// Update lại biến Static
/// </summary>
private void ReloadDanhMucChung(DbSet<Dm_LoaiDanhMuc> db)
{
MvcApplication.ListLoaiDanhMuc = db.ToList();
}
示例4: CheckProductNameWithDictionary
private static List<Product> CheckProductNameWithDictionary(string productNameFirst, DbSet<Dictionary> dictionaries)
{
List<Product> products = new List<Product>();
SmartBuyEntities db = new SmartBuyEntities();
List<Dictionary> listDictionaryDB = dictionaries.ToList();
var status = false;
for (int i = 0; i < listDictionaryDB.Count(); i++)
{
if (status == true)
{
break;
}
if (products.Count == 0)
{
var dupDictionary = db.Dictionaries.Where(d => d.Name == productNameFirst).FirstOrDefault();
if (dupDictionary != null)
{
var existProduct = db.Products.Where(p => p.Id == dupDictionary.ProductId).FirstOrDefault();
products.Add(existProduct);
status = true;
}
}
if (CompareStringHelper.CompareString(listDictionaryDB[i].Name, productNameFirst) > 0.85)
{
var id = listDictionaryDB[i].ProductId;
var product = db.Products.Where(p => p.Id == id).FirstOrDefault();
if (products != null)
{
var result = products.Where(p => p.Id == product.Id).FirstOrDefault();
if (result == null)
{
products.Add(product);
}
}
else
{
products.Add(product);
}
}
}
return products;
}
示例5: CheckProductNameWithDictionary
private static int? CheckProductNameWithDictionary(string productNameFirst, DbSet<Dictionary> dictionaries)
{
foreach (var dictionary in dictionaries.ToList())
{
double compare = CompareStringHelper.CompareString(dictionary.Name, productNameFirst);
if (compare > 0)
{
return dictionary.ProductId;
}
}
return 0;
}