Using List<T> in class

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
dqrest
Posts: 32
Joined: Tue 15 Sep 2015 06:01

Using List<T> in class

Post by dqrest » Fri 18 Sep 2015 12:20

Hi!
I have 2 questions.
I have Devart.Data.Linq 4.4.697.0, Devart.Data.Oracle.Linq 4.4.697.0, Devart.Data.Oracle. 8.4.359.0 and use MS VS 2013 Ultimate.

The first question.
Can I use List<T> in the class which is formed in linq expressions.

For example,

var res = from c in All.SysFilterCriterions
where c.FilterNo == filterNo select new MyClass { No = c.FilterNo, myList = new List<int>() };

public class MyClass
{
public long No;
List<int> myList;
}

Can I use List<T> in MyClass.

The second question.
Because I use a Devart.Data.Linq 4.4.697.0, Devart.Data.Oracle.Linq 4.4.697.0, Devart.Data.Oracle. 8.4.359.0, I should use Devart.Data.Linq.Mapping instead of System.Data.Linq.Mapping to map tables from database. In this case, should I use Devart.Data instead of System.Data?

dqrest
Posts: 32
Joined: Tue 15 Sep 2015 06:01

Re: Using List<T> in class

Post by dqrest » Fri 18 Sep 2015 13:12

At last, I'd like to ask the third question.

Is System.Linq.Dynamic compatible to Devart.Data.Linq 4.4.697.0, i.e. can I get some problems with mapping of table and executing linq expressions in code?

Can I construct a dynamic query in LINQ with System.Linq.Dynamic and Devart.Data.Linq 4.4.697.0 ?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Using List<T> in class

Post by MariiaI » Mon 21 Sep 2015 10:05

Can I use List<T> in MyClass.
The should be no problems with the code snippet you have specified. Did you encounter any error with this? If yes, please specify more details.
In this case, should I use Devart.Data instead of System.Data?
No, you should use Devart.Data additionally to System.Data. However, you should remove all occurrences of System.Data.Linq.
LinqConnect uses its own classes since version 4.0 (since this version the references to System.Data.Linq are removed, LinqConnect uses only its own classes; there were a lot of fixes/improvements since this version, including the code generation, compiled query cache, etc.).
For correct work with LinqConnect it is necessary to use Devart.Data.Linq instead of System.Data.Linq.
Is System.Linq.Dynamic compatible to Devart.Data.Linq 4.4.697.0, i.e. can I get some problems with mapping of table and executing linq expressions in code?
Can I construct a dynamic query in LINQ with System.Linq.Dynamic and Devart.Data.Linq 4.4.697.0 ?
Yes, System.Linq.Dynamic can be used with Devart.Data.Linq. If you encounter any issues with this, feel free to contact us.

Post Reply