.Net Core Entity Framework - Read Multiple Objects

Viewed 204

I did use the code first programming pattern with the entity Framework in .net core. I created a database which works really great and I can save data to it.

The data is saved in an SQLite Database. When I take a look at the Database I see that there are columns inserted and the data is available.

Now I would like to read Data from the Database. In this case I am using following code:

DatabaseContext db = new DatabaseContext();
MicroserviceMetric result = db.MicroserviceMetrics.LastOrDefault();

The Database Context is the Context which represents the Database. There is a MicroserviceMetrics DbSet which holds different classes of the Type MicroserviceMetric. This class also have some different Objects and Lists, but anyway the Data could be inserted in a correct way.

But the example at top Returns only as a result the primitive datatype Primary key which is represented as an integer. The other objects are not readable and there is a null, although the data is available in the database.

I tried a lot of different things, but it doesn't work.

0 Answers
Related