private static Row GetBuilder(Result result, string aggregate, bool distinct) { var processName = "Dp" + result.Name[0].ToString(CultureInfo.InvariantCulture).ToUpper() + result.Name.Substring(1); var builder = new ProcessBuilder(processName) .Star(aggregate) .StarEnabled(false) .Connection("input") .Provider("internal") .Connection("output") .Provider("internal") .Entity(aggregate) .DetectChanges(false) .InputOperation(new RowsOperation(result.Rows)) .Group() .Field("group") .Input(false) .Default("group") .Aggregate("group") .PrimaryKey(); foreach (var field in result.Fields) { builder .Field(field.Name) .Length(field.Length) .Type(field.Type) .Aggregate(aggregate) .Distinct(distinct); } return ProcessFactory.CreateSingle(builder.Process()).Execute().First(); }