0

I have to write an application which is creates/updates/deletes database entries. This part I've done, however I must also implement a function that returns the current size of the database in KB/MB which I'm having bigger problems with.

Basically I'm doing Code First, so I created the model class and the DBContext class for it which returns value I need.

Is there a way for, let's say a DBSet, to somehow get the size of my DB entries in KB/MB? I've googled to find if maybe there are some other helpful classes for this but no luck.

4
  • Are you using LocalDB or an external SQL Server to host the resulting database? Additionally, if using LocalDB, are you attaching it as a file? Commented Jan 8, 2014 at 11:54
  • For testing purposes I'm using LocalDB now however I will be imigrating to to an external server. The result must by set by code Commented Jan 8, 2014 at 12:02
  • 3
    Work out how to get the size using raw sql stackoverflow.com/questions/18014392/… then run raw sql using DbContext msdn.microsoft.com/en-gb/data/jj592907.aspx Commented Jan 8, 2014 at 12:05
  • Thanks! I'll definitely try using this Commented Jan 8, 2014 at 12:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.