Good day! The second day I can not understand why EF does not pull values from the table ...
Table creation script:
CREATE TABLE "Category" ( `Id` INTEGER NOT NULL, `Name` TEXT NOT NULL, `MinPercent` REAL NOT NULL, `MaxPercent` REAL NOT NULL, `HasEmployee` INTEGER NOT NULL DEFAULT 0, `Surcharge` REAL NOT NULL DEFAULT 0, `SalaryRate` REAL NOT NULL, `CurrencyId` INTEGER NOT NULL, PRIMARY KEY(`Id`), FOREIGN KEY(`CurrencyId`) REFERENCES `Currency`(`Id`) ) Model Class Code:
[Table("Category")] public class Category { [Key] public Int32 Id { get; set; } public String Name { get; set; } public Single MinPercent { get; set; } public Single MaxPercent { get; set; } public Boolean HasEmployee { get; set; } public Single Surcharge { get; set; } public Single SalaryRate { get; set; } public Int32 CurrencyId { get; set; } } Context DB Code:
public DbSet<Category> Category { get; set; } I select the data as follows:
public IEnumerable<Category> GetCategories { get { return _dbContext.Category; } } And all this selects 0 entries, although there are entries in the table. Who faced or who has ideas how to overcome it, tell me! Thank!
return _dbContext.Categorywill not return anything, you need to make a request using LINQ. - Bulson