Page 1 of 1

dotConnect throws NotSupportedException in WCF Service with EntityFramework

Posted: Tue 29 Jan 2013 11:12
by sbazant
Hello,
I'm developing a WCF service which imports excel files uploaded to FTP. I have an IIS FTP plugin which calls my WCF service. The service reads the file and imports its rows to PostgreSQL database. I use .net 4.5, entity framework 5, wcf, simpleinjector to accomplish this. I consume repository pattern and check wheter a record exists and if it does not I add data to repository and save, one record at a time. The entire service operation is single threaded. I use single DbContext for all import operations. DbContext lifestyle is PerWcfRequest. Every imported file consists of couple of hundred up to thousands of records.
When I upload single file everything runs fine, but when I try to upload multiple files simultaneusly, for some of them I get an exception:

Code: Select all

NotSupportedException: Specified method is not supported    in Devart.Common.DbConnectionInternal.get_ServerVersionNormalized()
   in Devart.Data.PostgreSql.al.u(Byte[] A_0, Int32 A_1, Int32 A_2)
   in Devart.Data.PostgreSql.j.a(Byte[] A_0, Int32 A_1, Int32 A_2)
   in Devart.Data.PostgreSql.al.a(Byte[] A_0, Int32 A_1, Int32 A_2)
   in Devart.Data.PostgreSql.PgSqlDataReader.GetValue(Int32 i)
   in Devart.Common.DbDataReaderBase.IsDBNull(Int32 ordinal)
   in Devart.Common.Entity.bf.IsDBNull(Int32 ordinal)
   in System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
   in lambda_method(Closure , Shaper )
   in System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
   in lambda_method(Closure , Shaper )
   in System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
   in System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
   in System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
   in System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2[TResult](IEnumerable`1 sequence)
   in System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
   in System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
   in System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
   in System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
(...) the rest of the stack trace is local source code.
I would be very grateful if You could help to debug this issue.

Re: dotConnect throws NotSupportedException in WCF Service with EntityFramework

Posted: Wed 30 Jan 2013 17:35
by Shalex
sbazant wrote:NotSupportedException: Specified method is not supported in Devart.Common.DbConnectionInternal.get_ServerVersionNormalized()
We have fixed the issue (addressed in the next public build which will be available next week). We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

The reason of the problem: connection has already been closed but fetch is still in progress. Assuming that you are working via Entity Framework, try opening context connection manually (context.Database.Connection.Open();) - it will be in the opened state unless you close it explicitly or context is disposed.

Re: dotConnect throws NotSupportedException in WCF Service with EntityFramework

Posted: Thu 07 Feb 2013 13:04
by Shalex
New build of dotConnect for PostgreSQL 6.4.179 is available!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=3&t=25831.