Hi,
I check that in ServiceStack Service.cs class is opened Db Connection on every time when is called request. Maybe exists solution to open Db Connection only one time (during start service or self-host application). Of course this factory should be resolved any exception as disconnecting all opened connection by database.
That wouldn’t be threadsafe, but you can still do that if you want with a static property that your Services can access that’s opened on Startup in AppHost.Configure.
Also opening a new db connection is not an issue for DB providers that use pooled connections like SqlServer does by default.
Pawel Kasperek:
Hi Dennis,
I use PostgreSQL database and the time of open connection is too long. This problem is in Npgsql driver and PostgreSQL backend. The resolution with opening connection on Startup in AppHost isn’t elegance . The second solution with use pooled connections like SqlServer should be better. I try check it and of course impemented