Ooui icon indicating copy to clipboard operation
Ooui copied to clipboard

Support server local attributes

Open mrange opened this issue 6 years ago • 4 comments

Local attributes are not sent to browser. Local attributes are useful for caching .NET objects on server side objects.

mrange avatar May 03 '18 07:05 mrange

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).

mrange avatar May 03 '18 08:05 mrange

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?

praeclarum avatar May 13 '18 18:05 praeclarum

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.

mrange avatar May 16 '18 17:05 mrange

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; } }

praeclarum avatar Aug 25 '18 16:08 praeclarum