NullReferenceException in simple query.

NullReferenceException in simple query.

Postby Cruatha » Thu 04 Oct 2012 22:29

I am evaluating LinqConnect for use in a project. I've done a ton of Hibernate work in Java, but am just starting to familiarize myself with .NET tech.

The database is MySQL.

I have a simple case, a Player. He has an id and some other simple fields.

Code: Select all
            CCNWDataContext ctx = new CCNWDataContext(csb.ConnectionString);

            var allPlayers = from p in ctx.Players select p;

            StringBuilder sb = new StringBuilder();
            foreach (var player in allPlayers)
            {
                sb.Append(player.ID);
                sb.Append(":");
            }


That works, I see a bunch of ids in the output of the Stringbuilder.

Code: Select all
            CCNWDataContext ctx = new CCNWDataContext(csb.ConnectionString);


            var allPlayers = from p in ctx.Players where p.ID==1 select p;

            StringBuilder sb = new StringBuilder();
            foreach (var player in allPlayers)
            {
                sb.Append(player.ID);
                sb.Append(":");
            }


That causes a NullReferenceException on the foreach line, somewhere deep in the obfuscated code. Stopping executing before it gets called and manually inspecting the object I see the same error.

My setup is .NET 4.0, referring to:
Devart.Data, Devart.Data.Linq, Devart.Data.Linq.Vs, Devart.Data.MySql, Devart.Data.MySql.Linq. Do I need all of these references?

The version is 4.1.101, trial.

Any help would be appreciated, so far I dig this one the most of the tech I'm evaluating.
Cruatha
 
Posts: 1
Joined: Thu 04 Oct 2012 22:13

Re: NullReferenceException in simple query.

Postby MariiaI » Fri 05 Oct 2012 12:47

We couldn't reproduce this issue with LinqConnect 4.1.101. We are sending you the table definition and a sample project to the e-mail address you provided in your forum profile. Please check that the letter is not blocked by your mail filter.
Please make changes to the project, so that the issue could be reproduced, and send it back to us.

As for the references, you need all these references, except Devart.Data.Linq.Vs.
JIC: Devart.Data, Devart.Data.MySql are assemblies, that include the functionality of the MySQL data provider; Devart.Data.Linq is the assembly with the core LinqConnect functionality; Devart.Data.MySql.Linq - the assembly with the LinqConnect functionality specific for MySQL databases; Devart.Data.Linq.Vs is an assembly for the design-time support in Visual Studio and it is not necessary to add it to the references.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to LinqConnect (LINQ to SQL support)