question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get metadata Schema Name return null value from dbcontext with UseInMemoryDatabase.

See original GitHub issue

I need to get some metadata from my entities and columns like MaxLenght, DefaultValue, Keys, isView, IsNull, etc.

Include your code


var options = new DbContextOptionsBuilder().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;
var context = new Adventureworks2019fullContext(options);

var entity = context.Model.FindEntityType("Person");
var schema = entity.GetSchema();

schema always return null

Include provider and version information

EF Core version: 6 Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer) Target framework: (e.g. .NET 6.0) Operating system: IDE: (e.g. Visual Studio 2022 Preview 2.1)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rojicommented, Aug 1, 2021

I thing this should not depend on the provider but on the attributes

The concept of a schema has no meaning in InMemory database - it’s a relational concept; this is why the attribute isn’t even processed by EF Core when using InMemory.

0reactions
JuanIrigoyencommented, Aug 2, 2021

ok, thank you very much for your support.

Best Regards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# dbcontext keeps returning null although data is ...
When I hit the endpoint using a get request with the appropriate language argument e.g. nl , I keep on getting null on...
Read more >
Breaking changes in EF Core 6.0
Complete list of breaking changes introduced in Entity Framework Core 6.0.
Read more >
Entity Framework Core 2 for the Enterprise
var entity = new Product(); // ID property has null value instead of 0. Now lets create a new Product in database:.
Read more >
Using OData with ASP.NET Core Web API
In this article, we will learn how to implement support for the OData standard in our ASP.NET Core Web API services.
Read more >
Untitled
Ef core dbcontext get table name WebA DbContext instance represents a session with the ... Get metadata Schema Name return null value from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found