Copied to clipboard

Flag this post as spam?

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


  • Gregg Duncan 48 posts 70 karma points
    Oct 14, 2010 @ 19:12
    Gregg Duncan
    0

    Using Custom Objects in Umbraco

    Let me preface my question by saying, I'm a total newb to Umbraco ( 2 days). So please forgive my ignorance.

    I'm trying to use umbraco to develop websites for a group of clients. The information for each client ( Name, address, phone numbers, email addresses, etc) are all available to me through a web service by passing the clients ID.

    I'm a .NET Web Developer. I use custom built objects to hold data and methods. I have custom objects already built to hold the client information that is retrieved from the webservice. If I were building this outside Umbraco I would get the client information on session start and load my custom object saving it as a session variable so that I can retrieve the information any time I need it.

    How would one accomplish this within the Umbraco framework? I've been searching for examples of using custom objects in Umbraco but I'm not finding anything. And the only thing I'm finding on session involves using xslt to retrieve the value from session. But unless I'm mistaken that only allows retrieval of primitive datatypes, not custom build objects or properties of objects.

    Am I completely missing the boat here (likely). Please give me some direction and remember I've only been speaking Umbraco for 2 days now, talk slowly.

    Thanks in advance for your help

  • Petr Snobelt 923 posts 1535 karma points
    Oct 14, 2010 @ 19:33
    Petr Snobelt
    0

    You can create your own xslt library to use in umbraco, or you can try look at base, or you can use c# and your objects in templates.

    Some links to help you start
    http://www.090978.org/umbraco-screencasts/xsltExtensions.html
    http://our.umbraco.org/wiki/reference/umbraco-base/programming-a-class-for-the-base-system
    http://farmcode.org/post/2010/07/13/TheFARMe28099s-guide-to-Macros.aspx

    Petr

  • Gregg Duncan 48 posts 70 karma points
    Oct 14, 2010 @ 20:54
    Gregg Duncan
    0

    Thanks for you quick reply, Petr.

    So correct me if I'm wrong but from what your links are telling me:

    1. I can NOT store data in a custom object on the server in Session or Cache to be used by Umbraco.
    2. I can use classes but I can only call static methods. And they must return either a string or an XpathNodeIterator.

    Can I create an xml representation of my custom object and save it in the XML Cache to be accessed when needed?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 15, 2010 @ 00:17
    Aaron Powell
    1

    If you're creating a custom component it doesn't need anything to do with Umbraco, you can run and .NET code via a UserControl or a custom ASPX or any other .NET component you want.

    This can interact with anything in the ASP.NET pipeline (session, runtime cache, etc), an external data store (using LINQ, NHibernate, etc).

    I've got a view resources on my site for different things to do with Umbraco development: http://www.aaron-powell.com/umbraco

  • Petr Snobelt 923 posts 1535 karma points
    Oct 15, 2010 @ 08:33
    Petr Snobelt
    0

    You CAN store your custom objects, I do it :-)

    In your static method is easy to access session etc.

     

Please Sign in or register to post replies

Write your reply to:

Draft