数据库相关

1.常用数据库连接字符串
MSSQL: Data Source=192.168.1.100;Initial Catalog=databaseName;User ID=sa;Password=******
MYSQL: Server=192.168.1.110;Port=3306;Database=databaseName;Uid=root;Pwd=******

 

2.EF多个左连接
var query =
  from ou in _organizationUnitRepository.GetAll()
  join uou in _userOrganizationRepository.GetAll() on ou.Id equals uou.OrganizationUnitId
  into temp

  from temp1 in temp.DefaultIfEmpty()
  join document in _entityRepository.GetAll() on temp1.UserId equals document.UserId
  into temp2

  group temp2 by ou into g
  select new OrganizationUnitListDto {
    ParentId=g.Key.ParentId,
    Code=g.Key.Code,
    DisplayName=g.Key.DisplayName,
    MemberCount=g.Count()
};

 

3.mysql命令:
登录mysql: mysql -u root -p
测试本地连接: mysql -h 127.0.0.1 -u root -p ******

 

posted @ 2020-02-12 14:31  kerwin cui  阅读(114)  评论(0编辑  收藏  举报