热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

3.EF6.0CodeFirst实现增删查改

原文链接:http:www.c-sharpcorner.comUploadFile3d39b4crud-operations-using-entity-framewo

原文链接:http://www.c-sharpcorner.com/UploadFile/3d39b4/crud-operations-using-entity-framework-5-0-code-first-approa/

或者:http://www.codeproject.com/Articles/640302/CRUD-Operations-Using-Entity-Framework-Code-Fi

系列目录:

 

  • Relationship in Entity Framework Using Code First Approach With Fluent API【【使用EF Code-First方式和Fluent API来探讨EF中的关系】】
  • Code First Migrations with Entity Framework【使用EF 做数据库迁移】
  • CRUD Operations Using Entity Framework 5.0 Code First Approach in MVC【在MVC中使用EF 5.0做增删查改】
  • CRUD Operations Using the Repository Pattern in MVC【在MVC中使用仓储模式,来做增删查改】
  • CRUD Operations Using the Generic Repository Pattern and Unit of Work in MVC【在MVC中使用泛型仓储模式和工作单元来做增删查改】
  • CRUD Operations Using the Generic Repository Pattern and Dependency Injection in MVC【在MVC中使用泛型仓储模式和依赖注入,来做增删查改】

 

本来不想写这篇的,因为感觉增删查改,实在是太Easy了。好了,为了巩固学习,还是继续吧:

打算实现书籍的增删查改,有两个实体,一个是Book【书籍实体】,另外一个是出版商实体【Publisher】,一个出版商可以出版很多书籍,一本书只能是由一个出版商出版。所以,书籍和出版商之间是一对多的关系。

先来看看整个项目的结构吧:

 

Entity实体中:

BaseEntity实体:【日期使用了数据注解,这样在显示的时候,就有格式了。】

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace EF.Entity
{
public abstract class BaseEntity{///

/// ID/// public int ID { get; set; }/// /// 添加时间/// ///
[DataType(DataType.Date)][DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]public DateTime AddedDate { get; set; }/// /// 修改时间/// ///
[DataType(DataType.Date)][DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]public DateTime ModifiedDate { get; set; }}
}

 

 Book实体:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace EF.Entity
{
///

/// Book实体/// public class Book:BaseEntity{/// /// 书名/// public string BookName { get; set; }/// /// 书的作者/// public string BookAuthor { get; set; }/// /// 书的价格/// public decimal BookPrice { get; set; }/// /// 出版商编号/// public int PublisherId { get; set; }/// /// 导航属性---出版商/// public virtual Publisher Publisher { get; set; }}
}

 

出版商实体:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace EF.Entity
{
public class Publisher:BaseEntity{///

/// 出版商的名字/// public string PublisherName { get; set; }/// /// 导航属性/// public virtual ICollection Books { get; set; }}
}

 

然后在EF.Data项目中:

BookMap类:

using EF.Entity;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace EF.Data
{
public class BookMap:EntityTypeConfiguration{public BookMap(){//配置主键this.HasKey(s => s.ID);//配置字段this.Property(s => s.ID).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);this.Property(s => s.BookName).HasColumnType("nvarchar").HasMaxLength(50).IsRequired();// this.Property(s => s.BookAuthor).HasColumnType("nvarchar(50)").IsRequired();//注意这个和BookName字段配置的区别之处:这样写EF生成不了数据库this.Property(s => s.BookAuthor).HasColumnType("nvarchar").HasMaxLength(50).IsRequired();this.Property(s => s.BookPrice).IsRequired();this.Property(s => s.AddedDate).IsRequired();this.Property(s => s.ModifiedDate).IsRequired();this.Property(s => s.PublisherId).IsRequired();//配置关系[一个出版商可以出版很多书籍]【外键单独配置,不是必须在Property中配置,当然也可以在Property中配置】this.HasRequired(s => s.Publisher).WithMany(s => s.Books).HasForeignKey(s => s.PublisherId).WillCascadeOnDelete(true);//配置表名字this.ToTable("Books");}}
}

PublisherMap类:

using EF.Entity;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace EF.Data
{
public class PublisherMap:EntityTypeConfiguration{public PublisherMap(){//配置主键this.HasKey(s => s.ID);this.Property(s => s.ID).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);// this.Property(s => s.PublisherName).HasColumnType("nvarchar(50)").IsRequired();//这样写,有问题,生成不了数据库this.Property(s => s.PublisherName).HasColumnType("nvarchar").HasMaxLength(50).IsRequired();this.Property(s => s.AddedDate).IsRequired();this.Property(s => s.ModifiedDate).IsRequired();}}
}

 

出版商我这里不做增删查改,到时候手动添加几条数据进去,然后在Book的视图中,把出版商做成下拉框的样式:所以我这里额外添加一个实体:【PublisherModel实体中的构造函数里的初始化属性嗲吗,不能忘记!!!】

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;namespace EF.Web.Models
{
public class PublisherModel{public PublisherModel(){PublisherList = new List();}[Display(Name="PublisherName")]public int PublisherID { get; set; }public List PublisherList { get; set; }}
}

 

数据上下文类:

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;namespace EF.Data
{
public class EFDbContext:DbContext{public EFDbContext(): base("name&#61;DbConnectionString"){ }protected override void OnModelCreating(DbModelBuilder modelBuilder){var typesToRegister &#61; Assembly.GetExecutingAssembly().GetTypes().Where(type &#61;> !String.IsNullOrEmpty(type.Namespace)).Where(type &#61;> type.BaseType !&#61; null && type.BaseType.IsGenericType&& type.BaseType.GetGenericTypeDefinition() &#61;&#61; typeof(EntityTypeConfiguration<>));foreach (var type in typesToRegister){dynamic configurationInstance &#61; Activator.CreateInstance(type);modelBuilder.Configurations.Add(configurationInstance);} //base.OnModelCreating(modelBuilder);
}}
}

Ef.Data项目和Web项目中都要加上连接字符串&#xff1a;

"DbConnectionString" connectionString&#61;"Server&#61;.;Database&#61;EFCURDDB;uid&#61;sa;Pwd&#61;Password_1" providerName&#61;"System.Data.SqlClient"/>

 

现在看看Web项目&#xff1a;

using EF.Data;
using EF.Entity;
using EF.Web.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;namespace EF.Web.Controllers
{
public class BookController : Controller{private EFDbContext db;public BookController(){db &#61; new EFDbContext();}#region 列表///

/// 列表/// /// public ActionResult Index(){return View(db.Set().ToList());}#endregion#region AddBook/// /// 添加Book/// /// public ActionResult AddBook(){PublisherModel model &#61; new PublisherModel();List listPublisher &#61; db.Set().ToList();foreach (var item in listPublisher){model.PublisherList.Add(new SelectListItem(){Text &#61; item.PublisherName,Value &#61; item.ID.ToString()});}ViewBag.PublishedList &#61; model.PublisherList;return View();}/// /// 添加Book/// ///
[HttpPost]public ActionResult AddBook([Bind(Include &#61; "BookName,BookAuthor,BookPrice,AddedDate,ModifiedDate,PublisherId")] Book model){Book addBook &#61; new Book() {AddedDate&#61;model.AddedDate,BookAuthor&#61;model.BookAuthor,BookName&#61;model.BookName,BookPrice&#61;model.BookPrice,ModifiedDate&#61;model.ModifiedDate,PublisherId &#61; Convert.ToInt32( Request["PublishedName"].ToString())//这里因为出版商我用的是另外的Model&#xff0c;视图中使用模型绑定只能用一个Model&#xff0c;所以修改和添加只能这样搞了。
};db.Entry(addBook).State &#61; EntityState.Added;db.SaveChanges();return RedirectToAction("Index");}#endregion#region UpdateBook/// /// 修改Book/// /// /// public ActionResult UpdateBook(int bookId){PublisherModel model &#61; new PublisherModel();List listPublisher &#61; db.Set().ToList();foreach (var item in listPublisher){model.PublisherList.Add(new SelectListItem(){Text &#61; item.PublisherName,Value &#61; item.ID.ToString()});}ViewBag.PublishedList &#61; model.PublisherList;Book bookModel &#61; db.Set().Where(s &#61;> s.ID &#61;&#61; bookId).FirstOrDefault();return View(bookModel);}/// /// 修改Book/// /// ///
[HttpPost]public ActionResult UpdateBook([Bind(Include &#61; "ID,BookName,BookAuthor,BookPrice,AddedDate,ModifiedDate,PublisherId")] Book model) //注意这里一定别忘记绑定 ID列哦
{Book bookModel &#61; db.Set().Where(s &#61;> s.ID &#61;&#61; model.ID).FirstOrDefault();if (bookModel !&#61; null){Book updatemodel &#61; new Book() {AddedDate &#61; model.AddedDate,BookAuthor &#61; model.BookAuthor,ID &#61; model.ID,ModifiedDate &#61; model.ModifiedDate,BookName &#61; model.BookName,BookPrice &#61; model.BookPrice,PublisherId &#61; Convert.ToInt32(Request["PublishedName"].ToString())//这里因为出版商我用的是另外的Model&#xff0c;视图中使用模型绑定只能用一个Model&#xff0c;所以修改和添加只能这样搞了。
}; db.Entry(bookModel).CurrentValues.SetValues(updatemodel); //保存的另外一种方式
db.SaveChanges();return RedirectToAction("Index");}else{return View(model);}#region 保存的方式二//db.Entry(model).State &#61; EntityState.Modified;//db.SaveChanges();//return RedirectToAction("Index"); #endregion}#endregion#region DeleteBookpublic ActionResult DeleteBook(int bookId){Book model &#61; db.Set().Where(s &#61;> s.ID &#61;&#61; bookId).FirstOrDefault();return View(model);}[HttpPost]public ActionResult DeleteBook(int bookId, FormCollection form){Book model &#61; db.Set().Where(s &#61;> s.ID &#61;&#61; bookId).FirstOrDefault();db.Entry(model).State &#61; EntityState.Deleted;db.SaveChanges();return RedirectToAction("Index");}#endregion}
}

 

视图代码&#xff0c;我使用MVC模板生成&#xff1a;【适当做修改】

AddBook视图&#xff1a;

&#64;model EF.Entity.Book&#64;{ViewBag.Title &#61; "AddBook";
}

AddBook

&#64;using (Html.BeginForm("AddBook","Book",FormMethod.Post))
{&#64;Html.AntiForgeryToken()
class&#61;"form-horizontal">

Book


&#64;Html.ValidationSummary(true, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.AddedDate, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.AddedDate, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.AddedDate, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.ModifiedDate, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.ModifiedDate, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.ModifiedDate, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.BookName, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.BookName, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.BookName, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.BookAuthor, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.BookAuthor, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.BookAuthor, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.BookPrice, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.BookPrice, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.BookPrice, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.PublisherId, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.DropDownList("PublishedName", ViewData["PublishedList"] as List)&#64;*&#64;Html.EditorFor(model &#61;> model.PublisherId, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })*&#64;&#64;Html.ValidationMessageFor(model &#61;> model.PublisherId, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">
class&#61;"col-md-offset-2 col-md-10">"submit" value&#61;"Create" class&#61;"btn btn-default" />

}
&#64;Html.ActionLink("Back to List", "Index")


UpdateBook视图&#xff1a;

&#64;model EF.Entity.Book&#64;{ViewBag.Title &#61; "UpdateBook";
}

UpdateBook

&#64;using (Html.BeginForm("UpdateBook","Book",FormMethod.Post))
{&#64;Html.AntiForgeryToken()
class&#61;"form-horizontal">

Book


&#64;Html.ValidationSummary(true, "", new { &#64;class &#61; "text-danger" })&#64;Html.HiddenFor(model &#61;> model.ID)
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.AddedDate, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.AddedDate, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.AddedDate, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.ModifiedDate, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.ModifiedDate, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.ModifiedDate, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.BookName, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.BookName, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.BookName, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.BookAuthor, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.BookAuthor, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.BookAuthor, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.BookPrice, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.EditorFor(model &#61;> model.BookPrice, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })&#64;Html.ValidationMessageFor(model &#61;> model.BookPrice, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">&#64;Html.LabelFor(model &#61;> model.PublisherId, htmlAttributes: new { &#64;class &#61; "control-label col-md-2" })
class&#61;"col-md-10">&#64;Html.DropDownList("PublishedName", ViewData["PublishedList"] as List)&#64;*&#64;Html.EditorFor(model &#61;> model.PublisherId, new { htmlAttributes &#61; new { &#64;class &#61; "form-control" } })*&#64;&#64;Html.ValidationMessageFor(model &#61;> model.PublisherId, "", new { &#64;class &#61; "text-danger" })
class&#61;"form-group">
class&#61;"col-md-offset-2 col-md-10">"submit" value&#61;"Save" class&#61;"btn btn-default" />

}
&#64;Html.ActionLink("Back to List", "Index")


注意:这里我只是把有改动的视图贴了出来&#xff0c;其他的视图&#xff0c;根据MVC模板生成之后&#xff0c;就不用管了。

&#64;model IEnumerable&#64;{ViewBag.Title &#61; "Index";
}

Index

&#64;Html.ActionLink("Create New", "AddBook")


class&#61;"table">&#64;foreach (var item in Model) {
}
&#64;Html.DisplayNameFor(model &#61;> model.AddedDate)&#64;Html.DisplayNameFor(model &#61;> model.ModifiedDate)&#64;Html.DisplayNameFor(model &#61;> model.BookName)&#64;Html.DisplayNameFor(model &#61;> model.BookAuthor)&#64;Html.DisplayNameFor(model &#61;> model.BookPrice)&#64;Html.DisplayNameFor(model &#61;> model.PublisherId)
&#64;Html.DisplayFor(modelItem &#61;> item.AddedDate)&#64;Html.DisplayFor(modelItem &#61;> item.ModifiedDate)&#64;Html.DisplayFor(modelItem &#61;> item.BookName)&#64;Html.DisplayFor(modelItem &#61;> item.BookAuthor)&#64;Html.DisplayFor(modelItem &#61;> item.BookPrice)&#64;Html.DisplayFor(modelItem &#61;> item.PublisherId)&#64;Html.ActionLink("Edit", "UpdateBook", new { bookId &#61; item.ID }) |&#64;Html.ActionLink("Details", "DetailsBook", new { bookId &#61; item.ID }) |&#64;Html.ActionLink("Delete", "DeleteBook", new { bookId &#61; item.ID })

效果图&#xff1a;

 

 

 

 总结&#xff1a;1.下拉框实体中&#xff0c;构造函数初始化语句不能忘记。

2.修改的方式&#xff0c;有新变化看代码&#xff1b;

3.模型绑定的时候&#xff0c;特别要注意&#xff0c;Bind的字段&#xff0c;修改的时候&#xff0c;Bind字段ID不能少。

 



推荐阅读
  • 生成式对抗网络模型综述摘要生成式对抗网络模型(GAN)是基于深度学习的一种强大的生成模型,可以应用于计算机视觉、自然语言处理、半监督学习等重要领域。生成式对抗网络 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • 本文介绍了闭包的定义和运转机制,重点解释了闭包如何能够接触外部函数的作用域中的变量。通过词法作用域的查找规则,闭包可以访问外部函数的作用域。同时还提到了闭包的作用和影响。 ... [详细]
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • Commit1ced2a7433ea8937a1b260ea65d708f32ca7c95eintroduceda+Clonetraitboundtom ... [详细]
  • 本文讨论了在Windows 8上安装gvim中插件时出现的错误加载问题。作者将EasyMotion插件放在了正确的位置,但加载时却出现了错误。作者提供了下载链接和之前放置插件的位置,并列出了出现的错误信息。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了C#中生成随机数的三种方法,并分析了其中存在的问题。首先介绍了使用Random类生成随机数的默认方法,但在高并发情况下可能会出现重复的情况。接着通过循环生成了一系列随机数,进一步突显了这个问题。文章指出,随机数生成在任何编程语言中都是必备的功能,但Random类生成的随机数并不可靠。最后,提出了需要寻找其他可靠的随机数生成方法的建议。 ... [详细]
  • 本文介绍了Redis的基础数据结构string的应用场景,并以面试的形式进行问答讲解,帮助读者更好地理解和应用Redis。同时,描述了一位面试者的心理状态和面试官的行为。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • 本文介绍了机器学习手册中关于日期和时区操作的重要性以及其在实际应用中的作用。文章以一个故事为背景,描述了学童们面对老先生的教导时的反应,以及上官如在这个过程中的表现。同时,文章也提到了顾慎为对上官如的恨意以及他们之间的矛盾源于早年的结局。最后,文章强调了日期和时区操作在机器学习中的重要性,并指出了其在实际应用中的作用和意义。 ... [详细]
  • 本文详细介绍了如何使用MySQL来显示SQL语句的执行时间,并通过MySQL Query Profiler获取CPU和内存使用量以及系统锁和表锁的时间。同时介绍了效能分析的三种方法:瓶颈分析、工作负载分析和基于比率的分析。 ... [详细]
author-avatar
氣質正妹_384
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有