WPF Treeview Databinding Hierarchal Data with mixed types

Since you want the elements in the TreeView to have a list of children that consists of both Categories Products, you will want your Category ViewModel to have a collection that consists of both Categories and Products. For example, you could use a CompositeCollection to combine your existing collections: public class Category { public string …

Read more

Oracle SYS_CONNECT_BY_PATH equivalent query into SQL Server

CREATE TABLE #MY_TABLE ( ID INT ,ID_FATHER INT ,COL_X INT ) CREATE TABLE #MY_TABLE_BIS ( MY_ID INT ,X VARCHAR(50) ) CREATE TABLE #OTHER_TABLE ( MY_ID INT ,[ROOT] VARCHAR(50) ) CREATE TABLE #BIG_TABLE ( AN_ID INT ) go DECLARE @MAXDEPTH INT = 10 ;WITH cte_prepare AS ( SELECT ID ,ID_FATHER ,TB.X ,OT.[ROOT] FROM #MY_TABLE T LEFT …

Read more

How to represent a data tree in SQL?

I’ve bookmarked this slidshare about SQL-Antipatterns, which discusses several alternatives: http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back?src=embed The recommendation from there is to use a Closure Table (it’s explained in the slides). Here is the summary (slide 77): | Query Child | Query Subtree | Modify Tree | Ref. Integrity Adjacency List | Easy | Hard | Easy | Yes Path …

Read more

What type of NoSQL database is best suited to store hierarchical data?

MongoDB and CouchDB offer solutions, but not built in functionality. See this SO question on representing hierarchy in a relational database as most other NoSQL solutions I’ve seen are similar in this regard; where you have to write your own algorithms for recalculating that information as nodes are added, deleted and moved. Generally speaking you’re …

Read more