I am not sure if everyone is enjoying Nolics as much as I am (that sounds pretty lame) so I thought I would post on one of the neat things that you can do with the Nolics.
Below is a Nolics .dbclass file for hierarchal related category data. Notice how you can linked parentID to the same table instead of a standard GUID field. This allows you to have a strongly typed reference to the parent category after a query. Also notice how you can have a relation to the ChildArray in the same table. This allows you to get an object reference to each of the child objects. Most know that you can do this for related tables, but applying this feature for hierarchal related data in the same table I thought was nice touch.
The only downside to Nolics database objects for hierarichal data is that the RadTree doesn't recognize the relationship between the parentID and ID so you have to populate your RadTreeView using the recursive method, but that's not too slow.
If anyone else has any Nolics tips I would love to hear about them.
|dbclass Category [TableName="category",WebBinder=true] |
| primary key guid ID[AutoGenGUID=True]; |
| string Name; |
| string UniqueName; |
| string Description; |
| int Order; |
| bool Active; |
| bool IsRoot; |
| string HeadDescription; |
| string HeadKeywords; |
| link Category ParentCategory_lnk: guid ParentID; |
| relation Category(ParentCategory_lnk) ChildArray; |
| relation ProductCategoryLink  ProductArray; |
| version long Version; |
| created date CreatedDate; |
| modified date ModifiedDate; |
|namespace queries; |
|query GetCategory for Category [ProcedureName="getcategory",OrderBy="CreatedDate DESC",WebBinder=true] |
| guid ID ?= ID; |
| string Name ?like Name; |
| string UniqueName ?= UniqueName; |
| string Description ?like Description; |
| guid ParentID ?= ParentID; |
| bool IsRoot [Nullable = True] ?= IsRoot; |
| bool Active [Nullable = True] ?= Active; |