0

I am using Linq-to-SQL (dbml) to work with dbf-database (LocalDB). This will be a local database for my application to hold some data.

I've noticed there are *.ldf and *_log.ldf files, which are quite big. While I assume, what some administration could be done with sql tools, I'd rather prefer not to require that in most cases. I already solve following problems: creating, attaching, detaching and file-based manipulations with mdf-file for a sort of primitive installation/backup (see my previous question).

Is it possible to get rid of ldf-files without putting too much effort? Like deleting them after detaching?

After finding this question, I've come to idea, what maybe it is possible to set simple recovery model in my dbml? This solution would be more optimal (if possible), as big ldf-files will not even be created.

How do I set simple recovery model when using dbml?

Community
  • 1
  • 1
Sinatr
  • 20,892
  • 15
  • 90
  • 319

1 Answers1

1

As far as I know, Not really directly in DBML.

But you can execute SQL through Linq.

The statement to use is:

ALTER DATABASE <database_name> SET RECOVERY [FULL | BULK_LOGGED | SIMPLE]

So in Linq it would be something like

db.ExecuteCommand("ALTER ... ");
Pleun
  • 8,856
  • 2
  • 30
  • 50
  • Didn't know it is that simple, thanks. Btw, setting simple mode doesn't decrease ldf-file size (maybe it already was simple?). So currently I am simple deleting all ldf-files after detaching database. Looks harmless so far. – Sinatr Sep 22 '14 at 11:16