简体   繁体   中英

EF 6.0 how to exec parameterless stored procedure?

iam using Entity Framework 6.1 and iam wondering what iam supposed to use to execute parameterless procedures. The Method Database.ExecuteSqlCommand() and Database.SqlQuery() both requires parameters. I figgured that I could pass an Empty string but Iam not sure its the right thing to do.

Database.ExecuteSqlCommand and Database.SqlQuery both take a params object[] parameters array, so you don't have to supply anything - it will simply be treated as an empty array if you do db.ExecuteSqlCommand("foo"); etc.

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