摘要:
假如一张表中有如下的数据: 当使用select Count(*) from TableName表示获取表中数据记录的条数; 有时候可以通过select Count(列名) from TableName来等价于select Count(*) from TableName,但是下面的情况就不会等价 结果 阅读全文
摘要:
普通的ADO.NET获取DataSet的写法如下: using System.Configuration; using System.Data; using System.Data.SqlClient; public class SQLHelper { private static readonly 阅读全文
摘要:
数据库中有一个City表 初始时数据: 实体类与Fluent Api配置映射 public class City { public int Id { get; set; } public string Name { get; set; } public int? ParentId { get; se 阅读全文
摘要:
在实际的项目开发中,可能会遇到同一张表同时保存自身和上级(或下级)的信息(一般是通过设置一个上级主键【ParentId】的列与主键【Id】关系) 例如:城市库,有国家、省、市...,省的ParentId是国家的Id,同理市的ParentId是省的Id public class City { /// 阅读全文