Jason
Jason

Reputation: 200

Entity Framework 6 localdb size limitations

I am attempting to use EF6 to create a localdb with the code first approach. Does EF prevent the maximum size (10G) to be reached? If it does reach that size of data, will EF create a new database? If so, would it be aware of the older instance of the localdb initially created?

The goal here is to be able to create separate localdb instances when needed, but also allow "queries" to cross between these separate localdb instances. This has been done via connection strings in C#, just wondering if we can leverage EF.

Upvotes: 0

Views: 844

Answers (1)

Erik Philips
Erik Philips

Reputation: 54618

Does EF prevent the maximum size (10G) to be reached?

No, Entity Framework simply provides access to SQL-Server. If SQL Server is going to limit you then it's going to limit you and no technology that provides access to SQL Server is going to override that.

If it does reach that size of data, will EF create a new database?

No. The thoughts on SQL Server is that if you need more than 10gb database, you should be using Standard Version or higher.

The goal here is to be able to create separate localdb instances when needed,

That is very hacky, and a very bad approach (in so many aspects).

but also allow "queries" to cross between these separate localdb instances.

As far as I am aware an Entity Framework Context will only query a single Connection String.

Overall

It appears you are trying to use a product for something it was not intended to be used for. LocalDb was designed to be used with limited database size. If you need more space, I'd recommend you choose SQL Server Standard or higher or another product that doesn't have limitations that prevent you from what you need to do.

There are tremendously horrible performance problems and technical aspects if you decide to go down the route of querying multiple LocalDB instances. If you query against table Person in multiple instances, you'll have to run that query for each instance. Then any relations for said Person are going to be even more difficult to manage.

I'd highly recommend you don't do this, it is a very bad idea

Upvotes: 1

Related Questions