home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Database: Refactor MP1 database for multi seat usage
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Anthony Vaughan" data-source="post: 1286676" data-attributes="member: 153283"><p>Just a quick point about iterations. When using Entity Framework and LINQ you commit changes by calling SaveChanges() on the connection handle.</p><p>It makes a dramatic difference if you put the SaveChanges inside an iterative loop, after each update, as opposed to placing it after the loop has finished but before closing the using scope. The difference is astonishing - by factors of over a hundred, I suspect.</p><p></p><p> using (var sql = new SQLite.NET.SQLiteClient(@"D:\klad\sqlitetest\sqlitetest\PictureDatabaseV3_1.db3"))</p><p> {</p><p> for (int i = 0; i < 1000; i++)</p><p> {</p><p> var res = sql.Execute("update picturedata set blah = 1 where idpicture=3856");</p><p> SaveChanges(); //bad</p><p> }</p><p> SaveChanges(); // good</p><p> }</p></blockquote><p></p>
[QUOTE="Anthony Vaughan, post: 1286676, member: 153283"] Just a quick point about iterations. When using Entity Framework and LINQ you commit changes by calling SaveChanges() on the connection handle. It makes a dramatic difference if you put the SaveChanges inside an iterative loop, after each update, as opposed to placing it after the loop has finished but before closing the using scope. The difference is astonishing - by factors of over a hundred, I suspect. using (var sql = new SQLite.NET.SQLiteClient(@"D:\klad\sqlitetest\sqlitetest\PictureDatabaseV3_1.db3")) { for (int i = 0; i < 1000; i++) { var res = sql.Execute("update picturedata set blah = 1 where idpicture=3856"); SaveChanges(); //bad } SaveChanges(); // good } [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Database: Refactor MP1 database for multi seat usage
Contact us
RSS
Top
Bottom