Copied to clipboard

Flag this post as spam?

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


  • Stephen 708 posts 2005 karma points core hq
    Jun 19, 2013 @ 09:21
    Stephen
    0

    Document types: class vs. interface

    I'm trying to understand how uSiteBuilder works and how that could be integrated with Strongly Typed content... as far as I can understand, a document type is defined by a class with various attributes that define the properties, etc.

    Would it make a difference if document types were defined by interfaces rather than classes? Or does uSiteBuilder actually really wants classes (for which purpose?)?

    The idea being, if uSiteBuilder uses interfaces, then there should be a way Strongly Typed content implement those interfaces "automatically" and one can use the uSiteBuilder models on the front end...

    Stephan

  • Vladan Ostojic 94 posts 205 karma points
    Jun 19, 2013 @ 09:50
    Vladan Ostojic
    1

    uSiteBuilder uses classes because it allows you not just defining document types but also rendering them in templates. See tutorials here: http://usitebuilder.vegaitsourcing.rs/tutorials , especially this one: http://usitebuilder.vegaitsourcing.rs/tutorials?id=22391

  • Stephen 708 posts 2005 karma points core hq
    Jun 19, 2013 @ 09:55
    Stephen
    0

    OK, got it. Thanks for the answer.

  • Morten Christensen 594 posts 2736 karma points admin hq
    Jun 19, 2013 @ 10:02
    Morten Christensen
    0

    Maybe you'll have better luck posting in the uSiteBuilder's Google Group?
    https://groups.google.com/forum/?hl=en#!forum/usitebuilder-developers

    I wish I had been able to find a "What is Code First"-type article, but haven't been able to yet. But think the unwritten rule to Code First is that you create a class that represents the object you want to create. So you have one specific implementation of ie. Article with Author and Text properties, and because its a concrete implementation there is no need for an interface. You might use interfaces (or just base classes) to add inheritance to the Article class, but you would not have multiple implementations of an Article (which would be the same in Umbraco - you don't have the notion of an interface for Document Types in Umbraco either, just like with Entity Framework's Code First approach which is "one to one" with the database).
    Not sure if this was a vague description :-/

    - Morten

Please Sign in or register to post replies

Write your reply to:

Draft