Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major overhaul and tree converting #39

Merged
merged 2 commits into from
Nov 15, 2018

Conversation

BenjaBobs
Copy link
Collaborator

@BenjaBobs BenjaBobs commented Nov 2, 2018

See #38 for a description.

Copy link
Owner

@evo-terren evo-terren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think this is all great. I really appreciate your contributions!

One generic comment, I typically do my best to adhere to Microsoft's coding standards and have noticed you use a lot of arrays and List in your methods and properties. This violates CA1002 and CA1819.

I haven't been able to figure out a way to run Code Analysis in .NET Core projects yet, but until I do, I'll still try to give feedback according to the rules I care about most. I'll at least spend some time adding come Code Style definition files to encourage uniformity there.

Get these small things updated when you get a chance and I'll create a new release.

Thanks again!


namespace Gremlin.Net.CosmosDb.Serialization
{
internal class AutoConnector : IVertexConnector, IEdgeConnector
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do me a favor and add some comments throughout this class and methods just to help future devs?


foreach (var prop in vertexProps)
{
if (prop.GetValue(edge) is object newEdgeVertex)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Using a switch here may be a bit cleaner than all the if/is checks you're doing:

switch (prop.GetValue(edge))
{
    case IVertex v:
        ConnectVertex(existingEdge, v);
        break;
    case IEnumerable vEnum:
        foreach (var vert in vEnum.OfType<IVertex>())
        {
            ConnectVertex(existingEdge, vert);
        }
        break;
}

/// <summary>
/// The list of Out vertices.
/// </summary>
public List<TOutV> OutV { get; set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be IReadOnlyCollection<TOutV> or at least IList<TOutV>.

/// <summary>
/// The list of In vertices.
/// </summary>
public List<TInV> InV { get; set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

/// <summary>
/// The list of Out vertices.
/// </summary>
public List<TOutV> OutV { get; set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

/// <summary>
/// The list of In vertices.
/// </summary>
public List<TInV> InV { get; set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You get the idea...

/// <typeparam name="T">The type to convert to.</typeparam>
/// <param name="treeConnectors">Custom connectors to use for attaching edges and vertices.</param>
/// <returns></returns>
public T[] ToObject<T>(List<ITreeConnector> treeConnectors = null)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please change this signature to be the following

public IEnumerable<T> ToObject<T>(IEnumerable<ITreeConnector> treeConnectors = null)

* Added comments to AutoConnector
* Made the default edges use IList instead of List
* Changed the signature of Tree
@BenjaBobs
Copy link
Collaborator Author

I addressed the pr issues and found (and fixed) a small error.

@evo-terren evo-terren merged commit a3d16f3 into evo-terren:master Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants