Devart.Data.Linq.Engine.ObjectReader to System.Collections.Generic.IEnumerator

Devart.Data.Linq.Engine.ObjectReader to System.Collections.Generic.IEnumerator

Postby Black Moon » Wed 30 Sep 2015 14:12

Hi All!

I updated dotConnect for Oracle DB from 6.50.228.0 to 8.4.359.0

Here's dbContext:
Code: Select all
public class TypeTreeDataContext : DataContext
   {
      public TypeTreeDataContext(OracleConnection conn) : base(conn) { ObjectTrackingEnabled = false; }
      public TypeTreeDataContext(OracleConnection conn, Devart.Data.Linq.Mapping.XmlMappingSource source) : base(conn, source) { ObjectTrackingEnabled = false; }   
      public Table<SysFilterCriterion> SysFilterCriterions;
}


Entity -
Code: Select all
[Table(Name = "SYS$FILTER_CRITERIONS")]
            public class SysFilterCriterion
            {
               long _No;
               [Column(Name = "NO", Storage = "_No", IsPrimaryKey = true)]
               public long No { get { return _No; } }

               long _FilterNo;
               [Column(Name = "FILTER_NO", Storage = "_FilterNo")]
               public long FilterNo { get { return _FilterNo; } }

               int? _OrderNo;
               ///<summary>Порядковый номер</summary>
               [Column(Name = "ORDER_NO", Storage = "_OrderNo")]
               public int? OrderNo { get { return _OrderNo; } }

               long? _FieldNo;
               ///<summary>Поле (ссылка на tdf$fields или tdf$blocks)</summary>
               [Column(Name = "FIELD_NO", Storage = "_FieldNo")]
               public long? FieldNo { get { return _FieldNo; } }

               string _Caption;
               ///<summary>Заголовок</summary>
               [Column(Name = "CAPTION", Storage = "_Caption")]
               public string Caption { get { return _Caption; } }

               string _WithoutTime;
               ///<summary>Поиск по полю без учета времени</summary>
               [Column(Name = "WITHOUT_TIME", Storage = "_WithoutTime")]
               public string WithoutTime { get { return _WithoutTime; } }

            }



When try to resolve SQL-query through Linq
Code: Select all
using (OracleConnection con = new OracleConnection() { UserId = "UserID", Password = "PSW", Server = "SERVER"})
        {
            con.Open();

            TypeTreeDataContext context = new TypeTreeDataContext(con);         

            var crits = context.GetTable<SysFilterCriterion>()
               .OrderBy(c => c.OrderNo)
               .Select(c => new
               {
                   No = c.No,
                   FieldNo = c.FieldNo,
                   Caption = c.Caption
                 
               }).ToList();

            IEnumerable<long> nos1 = crits.Select(c => c.No);

           

            con.Close();

        }


- got System.ArgumentException

cannot Transform Devart.Data.Linq.Engine.ObjectReader`1[<>f__AnonymousType0`3[System.Int64,System.Nullable`1[System.Int64],System.String]]" to type "System.Collections.Generic.IEnumerator`1[<>f__AnonymousType0`3[System.Int64,System.Nullable`1[System.Int64],System.String]]

Where's error?

if i resolve query with all columns such as
Code: Select all
var crits = context.GetTable<TypeTreeMapping.BaseClasses.Kernel.T93.SysFilterCriterion>()
               .OrderBy(c => c.OrderNo).ToList();


no error occurs...

Thanks.
Black Moon
 
Posts: 4
Joined: Tue 03 Mar 2015 20:07

Re: Devart.Data.Linq.Engine.ObjectReader to System.Collections.Generic.IEnumerator

Postby MariiaI » Thu 01 Oct 2015 06:53

This error is not reproducible in our environment with the latest build of LinqConnect 4.5.835 (dotConnect for Oracle 8.5.497).

Please try updating your dotConnect for Oracle to the latest version and notify us about the results. This build can be downloaded from https://www.devart.com/dotconnect/oracle/download.html of from Registered Users' Area (provided that you have an active subscription).

If this doesn't help, please provide us with the following information:
- send us DDL scripts for SYS$FILTERS, SYS$FILTER_CRITERIONS, SYS$FILTER_CRIT_PROPS tables (we have created them manually, thus, the definitions may be different);
- send us an example of the data stored in these tables (for example, several insert statements for three tables);
- the generated SQL query ( http://www.devart.com/linqconnect/docs/?Logging.html );
- the full call stack of the error with all inner exceptions (not just the error message).
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to LinqConnect (LINQ to SQL support)