Creating Mixins with ClaySharp

Jul 11, 2011 at 12:11 AM

  Is it possible to implement the concept of Mixins with ClaySharp?  Ideally, I'd like to create an attribute to make things taggable, for example like so:

[Taggable]
public class MyClass
{
    ....
}

By specifying this attribute, I would then be able to save tags along with MyClass objects without MyClass instances knowing they are taggable.  Is this doable? Or is there a much better way to go about extending functionality without the class knowing anything about it?

Coordinator
Jul 11, 2011 at 7:35 PM

Maybe not exactly the way you are describing it, but yes, that would be possible. Actually, if you look at the type system in Orchard, we are doing this already, composing object behavior from many parts. We are not doing it with Clay at this level though (we are using Clay in Orchard, just not for this).