Copied to clipboard

Flag this post as spam?

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


  • Yannick Smits 321 posts 718 karma points
    Feb 03, 2010 @ 14:55
    Yannick Smits
    1

    store datatype data in different database

    I've looked at several methods to create custom datatypes (especially those at nibble.be and the projects on our). But none of them seem to be able to ignore local saving completely.

    I want to hook a up an existing database and don't want to duplicate values in umbraco db.

    With the user control wrapper method described here it seems you still have to set the "umbracoValue".

    With the custom umbraco datatype method described here it seems you can't override the IData setter.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 03, 2010 @ 15:19
    Richard Soeteman
    1

    Hi Yannick,

    This is because normally you create a datatype to interact with Umbraco Data. I've created something for a client a while back that uses a database. I used a custom class that implemented the Idata interface that did basically nothing.I've used the Abstract Data Editor which is described here and used the OnSave event to store the data from that datatype in my database.

    This was a small part of a large project, don't know if you are going to the meetup on the 16th of February, I bring my laptop so I can show you the complete source then,

    Cheers,

    Richard

     

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 03, 2010 @ 15:22
    Thomas Höhler
    0

    You can implement your own datatype with the second link to retrieve data from the other database. The problem for sou is (as I guess right) that all the values will be written to the umbraco database too. But this is also an advantage, cause it will be included into the xml which is hold in the cache fetchable by xslt.

    Another way is to can create your datatype which only stores links (ids) to the entries in the other db. Then you have to implment a method for the templates to fetch the content on runtime. Disadvantage: no build in caching, you have to implement your own.

    I think your prob seems to be the sync of the two dbs then. If you use the first approach: There are methods to update values in the umbraco database via api. You 'only' have to implement on content changes in the external database or system.

    hth, Thomas

  • Yannick Smits 321 posts 718 karma points
    Feb 03, 2010 @ 16:17
    Yannick Smits
    0

    thanks guys for the fast response.

    Richard, good idea to implement your own umbraco.interfaces.IData. But why make it empty? why not hook it up to the external database directly from there? Why isn't that enough?

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 03, 2010 @ 16:53
    Richard Soeteman
    0

    Hi Yannick,

    It wasn't in my case for a reason I can't remember :-(.The project did a lot more than just saving the data. So maybe you can use your own implementation of IData to stopre the values.

    Cheers,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft