Copied to clipboard

Flag this post as spam?

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


  • Victor 1 post 71 karma points
    Dec 06, 2016 @ 16:52
    Victor
    0

    Best Practices (Autofac, extending umbraco DB, asp.net Identity, git)

    Hi everyone,

    so, a bunch of questions on the best practices :)

    there are 2 projects 1) vanilla umbraco project with custom macro and designs 2) asp.net mvc project, with ef6 code-first db derived from IdentityDbContext

    as of now those are 2 separate projects, 2 different databases, and 2 different user stores :)

    the goal is to have 1 project, 1 db, 1 user store.

    1) How should the db be extended with custom tables? Umbraco uses PetaPoco, the guides propose creating/migrating tables on app start in global.asax. Also Umbraco has it's own umbracoMigrations table, that handles migrations between versions.

    would using ef6 code-first, to initialize custom tables inside umbraco db, be a good solution? what would be the downsides of this approach?

    2) As of now the 2nd project uses asp.net identity, while umbraco uses older membership provider. there's a umbraco asp.net identity project (https://github.com/Shazwazza/UmbracoIdentity).

    the goal is to be able to link ef6 pocos to the user poco (either membership, or asp.net identity). As of now, AppDbContext is derived from IdentityDbContext, all the asp.net identity tables were created automatically on first migration, and FKs are created automatically.

    What would be the best solution to use same user store, usable with EF? I've read that umbraco 7.3.2 uses asp.net identity for backoffice.

    3) AutoFac integration: the 2nd project uses autofac for DI. i believe it should be quite simple to implement by buiulding container during app start: https://glcheetham.name/2016/05/27/implementing-ioc-in-umbraco-unit-testing-like-a-boss/

    4) upon clean umbraco nuget install, which files should go to VCS, and which shouldn't? i believe, we should omit Umbraco, UmbracoClient, Images, Media, AppBrowsers, App_Data, bin/obj. Should the Views folder go to VCS?

  • Lotte Pitcher 49 posts 242 karma points MVP 7x c-trib
    Dec 28, 2016 @ 22:52
    Lotte Pitcher
    0

    Hi Victor,

    Just before Christmas I wrote an article for the "24 days in Umbraco" website that you might find helpful:

    http://24days.in/umbraco-cms/2016/adding-umbraco-to-existing-site/

    It deals with ASP.Net Identity, DI, EF6, all in the one site with Umbraco. So hopefully there are some things in there that might give you some food for thought.

    I should be getting the source code posted to GitHub in a couple of days.

    Hope it helps, and good luck!

    Lotte

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Dec 29, 2016 @ 11:30
    Dave Woestenborghs
    0

    Hi Victor,

    For a project which needed a lot of custom db tables we used Peta Poco and Umbraco Migrations for creating/modifying database tables

    Here is a blog post explaining how to use them : https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft