摘要: 添加实体之后要打开程序包管理设置,输入enable-migrations迁移数据,add-migration 'createBlog' 创建Blog, updata-database更新数据库 创建接口IDAL 实现接口 阅读全文
posted @ 2021-11-30 22:49 浅夏y 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 建类存储信息,然后创建实体 阅读全文
posted @ 2021-11-30 01:57 浅夏y 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 先创建一个类库,然后安装EF框架,如果不能安装则创建实体数据模型-空Code First模型 写如下代码 然后创建类存储信息 阅读全文
posted @ 2021-11-28 23:41 浅夏y 阅读(27) 评论(0) 推荐(0) 编辑
摘要: @a//输出a@name@(a+12)//做运算处理加小括号@@//输出@用@@@Html.Raw(html) //输出html用html.raw+变量名 返回列表 //[NonAction]不允许访问方法 //[ActionName("dd")]访问的方法名字变成dd // GET: Studen 阅读全文
posted @ 2021-11-27 12:22 浅夏y 阅读(39) 评论(0) 推荐(0) 编辑
摘要: ViewResult 返回相应的视图: public ActionResult Index() { return View(); } ContentResult 返回字符串: public ActionResult Index(){return Content("");} RedirectResul 阅读全文
posted @ 2021-11-25 22:27 浅夏y 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 四种传值方式 ViewBag.Content = "这是内容";//一般储存不重要的数据 ViewData["Age"] = 40;//一般储存不重要的数据 TempData["hello word"] = "word";//全局变量,同Sesson,但使用一次后就自动清空 Model return 阅读全文
posted @ 2021-11-24 21:44 浅夏y 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 内置对象 Request Response Session Cookie Application Server 请求 响应 会话 客户端数据 当前网站对象 服务器对象/向客户端输入内容 Response.Write("hello word"); Session储存重要数据 如账号密码,安全,每个用户 阅读全文
posted @ 2021-11-23 23:59 浅夏y 阅读(32) 评论(0) 推荐(0) 编辑
摘要: .... 阅读全文
posted @ 2021-11-17 20:44 浅夏y 阅读(7) 评论(0) 推荐(0) 编辑
摘要: foreach (DataRow row in table.Rows) { var cls = new Classinfo() { Id = Convert.ToInt32(row["Id"]), Name = Convert.ToString(row["Name"]), Comment = Con 阅读全文
posted @ 2021-11-16 21:26 浅夏y 阅读(9) 评论(0) 推荐(0) 编辑
摘要: /* sql防注入 1.屏蔽特殊符号 2.参数化 */ /* 1.引入命名空间 2.垃圾自动回收 3.命名空间别名 public static DataTable Query(string sql,params SqlParameter[] sqlParameters){ }sql查询语句 sqlP 阅读全文
posted @ 2021-11-15 21:44 浅夏y 阅读(26) 评论(0) 推荐(0) 编辑