Copied to clipboard

Flag this post as spam?

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


  • Anders Burla 2560 posts 8256 karma points
    Oct 25, 2016 @ 14:48
    Anders Burla
    0

    Getting connection string?

    In Tea Commerce we use PetaPoco as the database ORM. Normally we do new PetaPoco("umbracoDbDSN") which is the name of the connection string in the web.config. Then PetaPoco figures out if its a sql server, SQLCE etc.

    I just pulled an Umbraco Uaas project (Umbraco 7.5.4) and installed Tea Commerce. The problem is that the "umbracoDbDSN" connection is to a SQL CE DB, but somehow UaaS does magic that connects to the dev sql environment on UaaS.

    Question is: how can we do a new PetaPoco and have it connect to the right "magic" Uaas DB?

    It's not an option to switch to the PetaPoco integrated into Umbraco as we want the Tea Commerce core to work without a reference to Umbraco.

    Kind regards

    Anders

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Oct 25, 2016 @ 16:06
    Niels Hartvig
    100

    Yes, it's crucial to how Umbraco Cloud (UaaS) works that you never connect the local website directly to the databases on the environments. On Umbraco Cloud each environment - also local - is always isolated to ensure that you don't corrupt databases (or end up in cache coherency issues) due to multiple people connecting different codebases to same db. Hence by default your db locally will be a created and sync'ed sql ce (but you could use a local sql server as well).

    The connection string name is the exact same on Umbraco Cloud, it just make sure it's always updated correctly (and automatically). On the Connection Details page of your project you can always see the details to connect the SQL Azure of the different environments as well as open the firewall. That way you can connect to SQL management studio and update any TeaCommerce related tables if you need to.

    Hope this helps!

  • Søren Kottal 702 posts 4497 karma points MVP 5x c-trib
    Nov 01, 2016 @ 14:35
    Søren Kottal
    0

    Hence by default your db locally will be a created and sync'ed sql ce (but you could use a local sql server as well).

    Any docs on how to use local sql server instead? Is it just by updating web.config? (and wont that be overwritten when pulling changes?)

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Nov 01, 2016 @ 15:40
    Sebastiaan Janssen
    0

    Export SQL CE database to SQL Server (easiest from WebMatrix). Update your connection string. Done. :)

    Whenever you deploy to Umbraco Cloud (UaaS) we ignore the connection string in your web.config and overrule it so it doesn't matter what you put in there.

    A word of warning though: you can not share that connection string with your colleagues so they all connect to the same SQL database on a central server. This will lead to corrupted data and will prevent you from deploying and using your Umbraco Cloud site effectively.

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Oct 25, 2016 @ 16:54
    Niels Hartvig
    0

    And to emphasize it means that what you're trying with initializing Petapoco withnew PetaPoco("umbracoDbDSN") will "just work" when you deploy (i.e. automatically use sqlce locally and the sql azure db when deployed :)

  • Anders Burla 2560 posts 8256 karma points
    Oct 27, 2016 @ 11:56
    Anders Burla
    0

    Hi Niels

    Thanks for the reply. Makes a lot of sense now that I know it.

    Is there some kind of info graphic that shows or explains from a developers point of view, how all these local, environments, content, media, files, etc is pushed between environments when you do a push command. Could be amazing to have some kind of "walk through" that shows what happens when content is edited (courier saves file to disk, file is commited, on app start the websites sees if courier files is there and executed the commands), or what happens when you save a doc type.

    Just an idea :)

    Have a great one.

    Kind regards

    Anders

Please Sign in or register to post replies

Write your reply to:

Draft