ReSharper and GhostDoc cleanup. #15

Closed
wants to merge 2 commits into
from

2 participants

@wforney

Did a bit of ReSharper and GhostDoc cleanup.

@robconery
Collaborator

I'd love to take this pull but I can't tell what's changed - the diff is a massive green block and a massive red block.

@wforney

Oh, there isn't much. I used GhostDoc to add some comments and then ReSharper to reformat the code. I pulled the one class out into another file (which you could just stuff back in there if you want). Other than that, I don't think it really did too much. I'll run a diff with Beyond Compare and see if I can provide detail to any actual changes that aren't comments.

@wforney

Ok, so aside from adding comments, redundant usings, and reformatting these things changed...

            var d = e as IDictionary<string, object>;
            for (int i = 0; i < rdr.FieldCount; i++)

changed to this:

            var d = (IDictionary<string, object>)e;
            for (var i = 0; i < rdr.FieldCount; i++)

this line:

            nv.Cast<string>().Select(key => new KeyValuePair<string, object>(key, nv[key])).ToList().ForEach(i => d.Add(i));

changed to this:

            nv.Cast<string>().Select(key => new KeyValuePair<string, object>(key, nv[key])).ToList().ForEach(d.Add);

Then the DynamicModel.cs was added and class moved into it and these changed...

            throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'");

becomes this:

            throw new InvalidOperationException(string.Format("Can't find a connection string with the name '{0}'", connectionStringName));

A few lines had redundant assignments to null that were removed.

        var stub = "INSERT INTO {0} ({1}) \r\n VALUES ({2})";

became:

        const string Stub = "INSERT INTO {0} ({1}) \r\n VALUES ({2})";

A few other lines like that were in other methods as well.

        var sql = string.Format("SELECT {0} FROM (SELECT ROW_NUMBER() OVER (ORDER BY {2}) AS Row, {0} FROM {3} {4}) AS Paged ",columns,pageSize,orderBy,TableName, where);

was swapped with this:

        var sql =
            string.Format(
                "SELECT {0} FROM (SELECT ROW_NUMBER() OVER (ORDER BY {1}) AS Row, {0} FROM {2} {3}) AS Paged ",
                columns,
                orderBy,
                this.TableName,
                where);

and this was changed in this method...

    DbCommand CreateCommand(string sql, DbConnection conn, params object[] args) {
        DbCommand result = null;
        result = _factory.CreateCommand();

to...

    private DbCommand CreateCommand(string sql, DbConnection conn, params object[] args)
    {
        var result = this._factory.CreateCommand();
        if (result == null)
        {
            throw new NullReferenceException("The command should not be null.");
        }

That should cover all the relevant changes.

@wforney

Oh, make sure you get the version with my latest edit tonight as ReSharper swapped dynamic for object in a few spots and I had to go back and fix it.

@robconery
Collaborator

As much as I appreciate what you've done - I like the way the code is laid out, and I like my comments as well.

@robconery robconery closed this Mar 31, 2011
@wforney

Ok, no big :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment