// GET: /Item/ public ActionResult Index() { DatabaseInitializer.DropCreateDatabaseIfModelChanges(); if (Request.IsAjaxRequest()) { return(PartialView(db.Items.ToList())); } return(View(db.Items.ToList())); }
// [Import(RequiredCreationPolicy = CreationPolicy.NonShared)] // public ContainerIn cin { get; set; } #region 主程序 private static void Main(string[] args) { //初始化数据库,如果存在且模型改变,删除重新建 DatabaseInitializer.DropCreateDatabaseIfModelChanges(); //初始化MEF组合容器 catalog = new AggregateCatalog(); catalog.Catalogs.Add(new DirectoryCatalog(Directory.GetCurrentDirectory())); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); _container = new CompositionContainer(catalog); _container2 = new CompositionContainer(catalog); bool exit = false; while (true) { try { Console.WriteLine("请输入命令:0; 退出程序,功能命令:1 - n"); string input = Console.ReadLine(); if (input == null) { continue; } switch (input.ToLower()) { case "0": exit = true; break; case "1": Method01(); break; case "2": Method02(); break; case "3": Method03(); break; case "4": Method04(); break; case "5": Method05(); break; case "6": Method06(); break; case "7": Method07(); break; case "8": Method08(); break; case "9": Method09(); break; case "10": Method10(); break; case "11": Method11(); break; case "12": Method12(); break; case "13": Method13(); break; case "14": Method14(); break; case "15": Method15(); break; case "16": Method16(); break; case "17": Method17(); break; } if (exit) { break; } } catch (Exception e) { ExceptionHandler(e); } } }