Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Byron Delgado 47 posts 70 karma points
    Mar 09, 2011 @ 11:03
    Byron Delgado
    0

    What about data types?

    The project looks very interesting. What about facilities to create data types in a easier way.

  • Vladan Ostojic 94 posts 210 karma points
    Mar 09, 2011 @ 13:20
    Vladan Ostojic
    1

    Hi Byron,

    Thank you for trying our framework. I'll paste a post from another thread that is hopefully answer to your question:

     

    About custom data types - those are not directly supported by our framework in a way that you can create data types through Visual Studio and have them deployed automatically. You must create your data type directly through browser in Umbraco as you always did. However, you can declare document type property in your class to be of that newly created data type as following:

     

            [DocumentTypeProperty(UmbracoPropertyType.Other,
                           
    Tab = "My Tab",
                           
    OtherTypeName = "MyCustomDataType",
                           
    Description = "Text.")]
           
    public string MyProperty

     

    In this example you declared property 'MyProperty' which is of 'MyCustomDataType' data type. What I did in this example is tht I set property type to UmbracoPropertyType.Other and set OtherTypeName to name of that custom data type. Note that string value of MyProperty during runtime will contain actual value of this data type (usually xml).

    Furthermore, instead of declaring property as string MyProperty you can declare it with your own .NET type (instead of string) if you build appropriate convertor (class that implements Vega.USiteBuilder.Types.ICustomTypeConvertor so that you don't hasle with xml every time when you use this property). But we'll explain that in some tutorial on our website.

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Mar 10, 2011 @ 09:25
    Sebastiaan Janssen
    0

    Byron, umbraco 4.6+ has a much improved way to create custom datatypes. Check out Tim's blog post for a good example.

  • Byron Delgado 47 posts 70 karma points
    Mar 10, 2011 @ 10:51
    Byron Delgado
    0

    Hi Sebastiaan, I think the new approach is great. The only problem I had was when I tried to save CDATA in an xml value, as posted here.

Please Sign in or register to post replies

Write your reply to:

Draft