当前位置: 首页>>代码示例>>C#>>正文


C# DbSet.ToList方法代码示例

本文整理汇总了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();
 }
开发者ID:puradawid,项目名称:openpaste,代码行数:8,代码来源:admin_pastes.aspx.cs

示例2: UpdateLoaiDanhMuc

 /// <summary>
 /// Update lại biến Static LoaiDanhMuc
 /// </summary>
 private void UpdateLoaiDanhMuc(DbSet<Dm_LoaiDanhMuc> db)
 {
     MvcApplication.ListLoaiDanhMuc = db.ToList();
 }
开发者ID:ACETeam90,项目名称:bacanhtai1,代码行数:7,代码来源:Dm_LoaiDanhMucController.cs

示例3: ReloadDanhMucChung

 /// <summary>
 /// Update lại biến Static 
 /// </summary>
 private void ReloadDanhMucChung(DbSet<Dm_LoaiDanhMuc> db)
 {
     MvcApplication.ListLoaiDanhMuc = db.ToList();
 }
开发者ID:ACETeam90,项目名称:bacanhtai1,代码行数:7,代码来源:Dm_DanhMucChungController.cs

示例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;
        }
开发者ID:dimparis,项目名称:smart-buy,代码行数:43,代码来源:ImportController.cs

示例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;
 }
开发者ID:dimparis,项目名称:smart-buy,代码行数:12,代码来源:TrainingController.cs


注:本文中的DbSet.ToList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。