ExecuteSingleNonQuery causes NullReferenceException

Mar 13, 2013 at 12:52 AM
Edited Mar 13, 2013 at 1:46 AM
I am running the ShardSample UI from the Enzo 2.0 Beta,
I Add connections. I can see my 2 shards. I do the Create Test Schema OK. Add to Shard works OK.

But if I try to Add User or Mass Update, I get the NullReferenceException from mthe line like the one below, probably because _shard is Null.

It appears that private ShardExpanded _shard in public class ShardExpanded : ShardCore in initialized to null, but never changed again.

I can not rebuild EnzoAzurLib, because one of the projects is missing from the distribution.

How can I fix this?

long rowsAffected = _shard.ExecuteSingleNonQuery(command, c.ConnectionString, exceptions);

See attached.
Mar 13, 2013 at 2:04 AM

Yes - there is an error in this implementation of the shard library in the BETA. You can remove the _shard variable altogether in this class and instead use the methods on the class directly.

So instead of

long rowsAffected = _shard.ExecuteSingleNonQuery(cmd, connections[connectionIndex].ConnectionString, exceptions);


long rowsAffected = ExecuteSingleNonQuery(cmd, connections[connectionIndex].ConnectionString, exceptions);