简体   繁体   中英

Entity Framework Core counting tables and records Code-First Approach (MySQL)

I've started using Entity Framework Core with Code-First approach and currently I'm not very used to it. My Entity Framework Core version is 3.1.20.

Q: How to check how many tables available in some specific database?

Q: How to get the total record count in some specific database?

Q: How to get the total record count in some specific table?

Q: How to check how many tables available in some specific database?

Check this answer

Q: How to get the total record count in some specific database?

This answer may help

var tablesinfo = ctx.GetTablesInfo();
var totalRecordCount = tablesinfo
    .IgnoreQueryFilters()
    .Sum(ti => ti.RecordCount);

Q: How to get the total record count in some specific table?

var recordCount = ctx.SomeTable.Count();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM