public static void RenewContext(ref DbApi context) { if (context != null) { context.Dispose(); } context = new DbApi(Cliver.CrawlerHost.Api.GetConnectionString(DATABASE_CONNECTION_STRING_NAME)); }
public static void RenewContext(ref DbApi context) { if (context != null) context.Dispose(); context = new DbApi(Cliver.CrawlerHost.Api.GetConnectionString(DATABASE_CONNECTION_STRING_NAME)); }
public static Dictionary<string, dynamic> GetCompanyCategories(DbApi db, int company_id) { List<string> categories = db.Products.Where(p => p.CompanyId == company_id).GroupBy(p => p.Category).Select(c => c.Key).ToList(); Dictionary<string, dynamic> tree = build_tree_from_paths(categories); return tree; }