简体   繁体   中英

How to create DbSet function from adding a table in Entity framework

I am maintaining the system from previous employees and I can't seem to replicate the creation this model public virtual DbSet<Account> Accounts { get; set; } public virtual DbSet<Account> Accounts { get; set; } public virtual DbSet<Account> Accounts { get; set; } inside context.cs

I have my entity, Bank.edmx then I will add a table. Account .

They have this line of code generated from the context.cs but it doesn't appear on my solution when I add the table. 在此处输入图片说明

I tried CodeFirst, but its not what they used, it's EF designer from database. Anything I am missing when adding the tables for the DbSet to appear?

after trying and trying, I found it. You have to tick Pluralize or singularize generated object names for it to have a DbSet

在此处输入图片说明

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