PetaPoco 中对作为集合的 POCO 属性进行水合的正确方法是什么?我想做这样的事情,但不知道怎么做。
return db.Fetch<ColorCategory, List<SubColor>, ColorCategory>((c, s) => { c.SubColors = *?*; return c; }, "SELECT [ColorCategory].[ColorCategoryID] " +
",[ColorCategory].[DisplayOrder] " +
",[ColorCategory].[Name] " +
",[ColorCategory].[ModifiedDate] " +
",[ColorCategory].[ModifiedUser] " +
",[SubColor].[SubColorID] " +
",[SubColor].[Name] " +
"FROM [ColorCategory] " +
"INNER JOIN [ColorCategorySubColor] ON [ColorCategory].[ColorCategoryID] = [ColorCategorySubColor].[ColorCategoryID] " +
"INNER JOIN [SubColor] ON [ColorCategorySubColor].[SubColorID] = [SubColor].[SubColorID]");
其中 ColorCategory 类有一个 List 属性 SubColors。