Ooui
Ooui copied to clipboard
Support server local attributes
Local attributes are not sent to browser. Local attributes are useful for caching .NET objects on server side objects.
Hi.
First of I really like the idea behind Ooui.
For fun (and potentially useful) I am implementing so called Formlets on top of Ooui. It's a way to create complex input forms quickly.
For Formlets to work I have the need of some new capabilities. One is the ability to cache state per object that isn't passed to the browser (because it wouldn't understand them anyway).
Oh fascinating - I hadn't considered a need for this.
What is the difference between the local attributes and just using normal object properties? Could you give me a rough use case so I can understand the problem better?
The need for local properties is that when I need to hook on data on an object. With object properties that is defined in the class I have no flexibility. One approach could be the famous Tag
property used by VB6 and Windows.Forms but that creates conflicts.
IMHO it's better to have ability to hook on arbritrary data like done in WPF with Attached Properties. I don't think it's necessary to go the full dependency propertry abstraction route though.
The way I use this for my formlets is that I want to hook on cached values on the node objects in the server DOM. I can't store this data in my formlets because they are stateless. The state lives in the UI.
I hope that makes sense.
If the data does not need to be transferred to the server, wouldn't it be better to just use normal C# properties in subclasses?
class MyDiv : Div { public object ExtraData { get; set; } }