I am really excited to announce that today -as part of the Beta5 marching- we checked in the SenseNetDataSource feature.
With this new ASP.NET DataSource you can use the Sense/Net Content Repository with the rich set of DataBound controls provided by Microsoft and other vendors (like GridView, ListView or Form) to produce more in less time using the data driven, rapid application development approach.
Also, the SenseNetDataSource (and some other controls I’ll tell you about later) makes it easier for you to build declarative solutions, that are easier to maintain, as much of the scenarios that in previous Betas needed coding now can be developed without a line of code – as long as we don’t consider writing html tags coding :).
So here is how it works: of course the way you expected it. You place a SenseNetDataSource object in the markup (you can do this from code of course) and link it to a DataBound control - GridView in our example.
The ContentPath attribute specifies the Content (typically a collection) we are interested in. MemberName is optional, and its default value is “Children” – so the default behavior is to list a content’s child items. You can also target reference properties with the MemberName attribute if the content has any (like “Related Articles” can be a reference property defined on an Article content type).
The result is as might expected to be:
Beyond accessing simple collections of the Content Repository, the SenseNetDataSource can also provide an easy access to the ContentQuery functionality. Setting the Filter, OrderBy and GroupBy attributes will help you to define your query expressions on an easy, declarative way.
But wait! Haven’t I seen Eval and BoundField there? So all these new stuff now needs C# classes and so? Do I have to define my content types in CODE NOW????
Wait, no! Not at all! Quite the contrary: the best thing is that all these data binding magic works with the Content Types you created as Content Types Definitions – mere XML data. This is a really really important thing: with Sense/Net 6.0 your are able to define data types – content types we call it – dynamically and then your are able to treat instances from them as strongly typed, bindable data entities.
Here is how it works:… But now I really must be going home :) I’ll finish this today, so stay tuned.