Copied to clipboard

Flag this post as spam?

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

  • Unknown 2 posts 22 karma points
    Oct 07, 2013 @ 09:25

    CRUD in Umbraco 6?

    Hello Developers

    I am fairly new to Umbraco but I have some questions.

    So while playing with it I think the set up of Umbraco is fairly easy. Adding content, editting content and so on can be done in no time. But when it gets more complex, I do no know how to get things done in Umbraco. Because I have experience in MVC3, I converted my Umbraco project to MVC. It's not 100% the same but I can live with it (for now).

    I have some data that I should store for my business logic. But how can I do that? Should I create a separate database to store that data and work with the Entity Framework to create, delete, retrieve the database? Or should I work with wat Umbraco offers? I want to now how people do this kind of stuff in Umbraco because that is not clear to me. Do they have tutorials on this?

    Thanks in advance!

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Oct 07, 2013 @ 09:39
    Andy Butland

    I would say so yes.  Unless the data you are storing is something you want to model and store in Umbraco itself - i.e. using the document types and storing and retreiving as standard Umbraco content.  

    If not, then yes a custom database (or custom tables in the same database) is a good way to go.  You can use any data access technique you are comfortable with.  Other than some extensions Umbraco has provided for PetaPoco that it uses internally for data access, I'm not aware there's any preferred way to go for this type of thing - so EF would be fine.


  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 07, 2013 @ 10:06
    Jeroen Breuer

    Here is a simple example of CRUD with Umbraco 6:


  • Unknown 2 posts 22 karma points
    Oct 07, 2013 @ 10:50

    Yes but that example uses Umbraco to store the data in Document Types and they are not as flexible as a separate database (relationships etc.). So I will go for a  separate database with EF or some other ORM tool.

  • Troels Larsen 75 posts 280 karma points
    Oct 07, 2013 @ 11:39
    Troels Larsen

    I would not boughter to implement EF cause umbraco allready has peta poco running. And therefor dont make a new database just append the tables u need to umbracos. and use that as your ORM. 

    var database = ApplicationContext.DatabaseContext.Database; gives u the database like in EF

    And the database Service uses and interface so u can deperency inject that into your controllers if thtat turns you on :)  

    is that what u are looking for ? 

Please Sign in or register to post replies

Write your reply to: