This question is locked. New answers and comments are not allowed.
Hello.
I'm using OA ver. 2012.1.301.2 in my WCF application. As a database I'm using sqlite.
I have service with InstanceContextMode.PerSession which owns OA model (OA context). I also have percall service (lets call it service2) which save some data in db. Service2 uses model provided by service1. I'm also using spatialite extension to store some geodata in sqlite db so in my case Save changes looks like:
When I'm trying batch insert lots of data it throws exceptions like NRE, "Telerik.OpenAccess.Exceptions.InvalidOperationException: Not allowed because Commit / Rollback is in progress" and etc.
So, I read this blog post and decided to use lock;
But when I have more than one sessions which own models I'm steel getting errors, exceptions like above.
I decided to use static lock for all models not for it's instance which ofcourse decreases performance and I got Telerik.OpenAccess.RT.sql.SQLException: The database file is locked.
All these problems I'm expecting when I'n trying to do batch insert, so
I tried every possible settings in Isolation level and transaction mode -- nothing helps. Maybe you can advice preferable settings
for working with sqlite with highload, some useful pragmas and etc. Maybe I should recompile sqlite engine with specific options?
Maybe there are some usefull patterns for this case (highload,sqlite)? Also can you explain for what purposes Multithread context option is if it doesn't help? I can provide you simple multithreaded application with settings that duplicate my main app.
Thank you very,very much in advance.
PS: I'm using 1.0.76.0 client of Sqlite for .net.
I'm using OA ver. 2012.1.301.2 in my WCF application. As a database I'm using sqlite.
I have service with InstanceContextMode.PerSession which owns OA model (OA context). I also have percall service (lets call it service2) which save some data in db. Service2 uses model provided by service1. I'm also using spatialite extension to store some geodata in sqlite db so in my case Save changes looks like:
public
partial
class
ArchivariusModel
{
internal
void
SaveGeoInfo()
{
using
(DbCommand cmd = Connection.StoreConnection.CreateCommand())
{
cmd.CommandText = @
"SELECT load_extension('libspatialite-2.dll');"
;
cmd.ExecuteNonQuery();
SaveChanges();
}
}
}
When I'm trying batch insert lots of data it throws exceptions like NRE, "Telerik.OpenAccess.Exceptions.InvalidOperationException: Not allowed because Commit / Rollback is in progress" and etc.
So, I read this blog post and decided to use lock;
public
void
SaveGeoData<T>(T data) where T :
class
{
if
(data ==
null
)
throw
new
ArgumentNullException(
"data"
);
lock
(_savelocker)
{
_model.Add(data);
_model.SaveGeoInfo();
}
}
But when I have more than one sessions which own models I'm steel getting errors, exceptions like above.
I decided to use static lock for all models not for it's instance which ofcourse decreases performance and I got Telerik.OpenAccess.RT.sql.SQLException: The database file is locked.
All these problems I'm expecting when I'n trying to do batch insert, so
SaveGeoData
calls one thread in percall wcf service.I tried every possible settings in Isolation level and transaction mode -- nothing helps. Maybe you can advice preferable settings
for working with sqlite with highload, some useful pragmas and etc. Maybe I should recompile sqlite engine with specific options?
Maybe there are some usefull patterns for this case (highload,sqlite)? Also can you explain for what purposes Multithread context option is if it doesn't help? I can provide you simple multithreaded application with settings that duplicate my main app.
Thank you very,very much in advance.
PS: I'm using 1.0.76.0 client of Sqlite for .net.