Any Docs about Select Method?

Sep 19, 2012 at 2:55 AM
Edited Sep 19, 2012 at 2:58 AM

how to use the SelectBuilder? Please giveme an example. Thank you.

return GetCurrentContext().Select<Domain.Personnel>("Id").OrderBy("Id").Paging(pageNum, pageSize).Query();

It will occur an error.

Coordinator
Sep 19, 2012 at 9:20 PM

You are missing From, try:

return GetCurrentContext().Select<Domain.Personnel>("Id").From("YourTable").OrderBy("Id").Paging(pageNum, pageSize).Query();
Sep 20, 2012 at 2:01 AM

Thanks.

And does SelectBuilder support inner/left join?

Coordinator
Sep 20, 2012 at 2:51 PM

Sorry that the documentation hasn't been updated yet, it will be soon.

Yes, joins are supported:

GetCurrentContext()
.Select<Product>("p.ProductId, c.Name")
.From("Product p inner join Category c on c.CategoryId = p.CategoryId)
.Where("ProductId = @ProductId")
.Parameter("ProductId", productIdVariable)
.OrderBy("p.ProductId")
.Paging(pageNum, pageSize).Query();

So you can basically do whatever you want to within the Select clause and Where clause since FluentData do not enforce any restrictions there. So you can use inner joins, left joins etc.

Sep 21, 2012 at 1:53 AM

Thank you, it's helpful.