Developer forum

Forum » Development » Group.GetGroupBySQL in DW8

Group.GetGroupBySQL in DW8

Magnus Holmberg
Reply

Why is the method Group.GetGroupsBySQL removed in DW8 or is just moved?

 

The Product.GetProductBySql still exists in DW8.

 

Best regards

//Magnus


Replies

 
Morten Bengtson
Reply

Hi Magnus,

I wondered about that too. However, if you don't need any joins and stuff like that then you can just query the cached groups by using linq...

using System.Linq;
using Dynamicweb.eCommerce.Products;

var selectedGroups = (from Group g in Group.GetAllGroups() where g.Number.StartsWith("X") select g).ToList();

You can also access a subset of groups through an instance of Shop or Product if that is what you need.

 

/Morten

 

 
Nicolai Høeg Pedersen
Reply

Hi both

 

It is still there. It is a static method with 2 overloads on the Products type:

 

Dynamicweb.eCommerce.Products.Product.GetProductBySql("select * from ecomproducts");

 

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Oh, my bad. Group.GetGroupsBySql

 

It has been removed due to caching issues. The groups are now persisted in cache and you have to use the GetAllGroups method.

 

The Groups are related to Shops and languages and that is why the BySql method has been deprecated.

Votes for this answer: 1
 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Also, the methods had been marked as Obsolete in the API since July 30th 2009, and were therefore completely removed with the restructuring in the DW8 API.

 

You must be logged in to post in the forum