Good afternoonI want to select items from different classes in Kentico.
So I have an array with strings:var allowedClassNames = new string[] { @project.classnameA@, @project.classnameB@,@project.classnameC@}Each classname has en need to have following columns:var columnTitles = @title,DocumentName,DocumentNodeID,DocumentUrlPath,NodeParentID,NodeLevel,ClassName@Only the column title is a custom column, the other ones are columns from Kentico.When I'm trying:var _tree = new TreeNode();
var nodes = _tree.SelectNodes().Types(allowedClassnames).Columns(columnTitles);
This gives an error: ColumnName 'title' does not exist.If've fixed it with writing:var _tree = new TreeNode();
var nodes = new List@TreeNode@();
foreach(var item in allowedClassNames) {
var elements = _tree.SelectNodes().Type(item, x =@ x.Columns(columnTitles);
nodes.AddRange(elements);
}
This is working, but the problem is I've been doing allowedClassNames.Length - times a call to the database, which is giving an error on production:A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)I guess this explains perfectly why I need a solution to do only one call.Kind regardsKenny
↧