public static IEnumerable <Vertex> GenerateProductVertices(List <Product> products, string partitionKey, int partitionsCount) { foreach (var product in products) { var vertex = new Vertex(product.Id.ToString(), "product"); vertex.AddProperty(new VertexProperty(partitionKey, product.Id % partitionsCount)); vertex.AddProperty(new VertexProperty("name", product.Name)); yield return(vertex); } }
public static IEnumerable <Vertex> GeneratePeopleVertices(List <Person> people, string partitionKey, int partitionsCount) { foreach (var person in people) { var vertex = new Vertex(person.Id.ToString(), "person"); vertex.AddProperty(new VertexProperty(partitionKey, person.Id % partitionsCount)); vertex.AddProperty(new VertexProperty("name", person.Name)); yield return(vertex); } }
// Genearting public static IEnumerable <Vertex> GenerateBrandVertices(List <Brand> brands, string partitionKey, int partitionsCount) { foreach (var brand in brands) { var vertex = new Vertex(brand.Id.ToString(), "brand"); vertex.AddProperty(new VertexProperty(partitionKey, brand.Id % partitionsCount)); vertex.AddProperty(new VertexProperty("name", brand.Name)); yield return(vertex); } }
private static IEnumerable <Vertex> GenerateVertices(int count) { StringBuilder propertyName = new StringBuilder(); for (int i = 0; i < count; i++) { Vertex v = new Vertex(i.ToString(), "vertex"); v.AddProperty(new VertexProperty(ConfigurationManager.AppSettings["PartitionKeyName"], i)); v.AddProperty(new VertexProperty("name", "name" + i)); for (int j = 0; j < 10; j++) { propertyName.Append("property"); propertyName.Append(j); v.AddProperty(new VertexProperty(propertyName.ToString(), "dummyvalue")); propertyName.Clear(); } yield return(v); } }