2

I currently have two entities in LLBLGen and would like to merge them together to output to a table to be used in a DevExpress GridControl in the same way that 2 tables joined together with an inner join.

Does anyone know how to do this with LLBLGen?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Tim Almond
  • 12,088
  • 10
  • 40
  • 50

2 Answers2

3

If you are using LLBLGen 2.6, you can use the LINQ to flatten the output using LLBLGen LINQ Provider.

Something on the way of (pseudo code)

var flat = from x in db.entitiesa()
           from y in db.entitiesb()
           select new { x.Name, y.Address }

and just throw variable 'flat' to the grid control.

DodyG
  • 511
  • 4
  • 8
2

Then the alternative is creating a dynamic list (below code comes from the help file) - it is unfortunately quite verbose.

DataAccessAdapter adapter = new DataAccessAdapter();
ResultsetFields fields = new ResultsetFields(3);
fields.DefineField(EmployeeFields.FirstName, 0, "FirstNameManager", "Manager");
fields.DefineField(EmployeeFields.LastName, 1, "LastNameManager", "Manager");
fields.DefineField(EmployeeFields.LastName, 2, "AmountEmployees", "Employee", AggregateFunction.Count);
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(EmployeeEntity.Relations.EmployeeEntityUsingEmployeeId, "Employee", "Manager", JoinHint.None);

IGroupByCollection groupByClause = new GroupByCollection();
groupByClause.Add(fields[0]);
groupByClause.Add(fields[1]);
DataTable dynamicList = new DataTable();
adapter.FetchTypedList(fields, dynamicList, bucket, 0, null, true, groupByClause);
DodyG
  • 511
  • 4
  • 8