0

Is it possible to adjust SQL Server connection parameters using Entity Framework in order to completely disable auto-shrink behaviour with parameter "autoshrink threshold = 100"?

  • SQL Server CE version: 4.0
  • EntityFramework: 6.1.3
  • EntityFramework.SQLServerCompact: 6.1.3
iljon
  • 398
  • 2
  • 16

1 Answers1

1

Yes of course, just add the setting to the connection string

ErikEJ
  • 40,951
  • 5
  • 75
  • 115
  • Thank you. Do you think that this setting prevents the database corruptions?. See: http://stackoverflow.com/questions/7343194/resolving-corruption-in-sql-server-compact-edition-database-files – iljon Oct 11 '16 at 16:51
  • To prevent corruptions, make sure to use the latest hotfix release: http://erikej.blogspot.dk/2016/02/sql-server-compact-40-sp1-hotfix.html – ErikEJ Oct 12 '16 at 09:10
  • Of course I'm using the latest hotfix (4.0.8902.0) but still we struggle with database corruptions. Eg. the portion of verification log: Selected page not found - idPage: 5030, iPage: 5501 Lossless data recovery is not possible. In order to keep system running we have to accept data loss. And I'm looking for solutions to avoid such situations – iljon Oct 12 '16 at 11:08
  • Are you using multiple threads and sharing ADO.NET objects across threads? – ErikEJ Oct 12 '16 at 11:15
  • No. This is simple desktop application which uses entityFramework. There are only background worker objects applied in order to support background processing for long running procedures. But but ADO objects are not shared between different threads. – iljon Oct 12 '16 at 11:21