Copied to clipboard

Flag this post as spam?

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


  • Robert Smith 18 posts 118 karma points
    Jan 25, 2018 @ 21:47
    Robert Smith
    0

    Add Entity Framework database to existing Umbraco site

    Hello,

    I am trying to create an Entity Framework database to an existing Umbraco project. I have setup all the MVC files I require according to the following tutorial: Getting Started with Entity Framework

    I am aware of the option of using PetaPoco to create and access databases within the main Umbraco database, but wanted to keep the data separate.

    For some reason, the database will not create itself. I can see the reference to the connection in Server Explorer, but there is no database to connect to and it keeps telling me the login has failed. For that matter, I am not able to find the database anywhere on my local dev machine.

    My suspicion is that Umbraco is somehow interfering with the creation of and connection to the Entity Framework database.

    Is this the case?

    If so, is it even possible to add a separate entity framework database to an Umbraco project? I have looked into this and it appears that you can add Umbraco to an existing DB, bu I am really trying to do the opposite.

    Thank you.

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 30, 2018 @ 13:26
    Alex Skrypnyk
    0

    Hi Robert

    Are you using the same connection string as Umbraco?

    The same database as Umbraco?

    Alex

  • Robert Smith 18 posts 118 karma points
    Jan 30, 2018 @ 13:53
    Robert Smith
    0

    Hi Alex,

    Thank you for the reply.

    No, I am using a separate database and connection string for localdb.

    Robert

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jan 30, 2018 @ 14:09
    Ismail Mayat
    0

    Robert,

    Check / double check your EF connection strings, are you able to connect with sql server management studio or even vs db explorer using those credentials? We have a number of sites with separate Db that is hit using EF within the context of an umbraco site.

    Regards

    Ismail

  • Robert Smith 18 posts 118 karma points
    Jan 30, 2018 @ 14:30
    Robert Smith
    0

    Hi Ismail,

    I have tried many different EF connection strings. The biggest problem seems to be that the database never gets created, although the connection shows up in Server Explorer with a red x next to it.

    I tired shutting off my antivirus, firewall etc. But that didn't help either.

    I also tried following the same steps with a new VS solution without umbraco. That solution created the database and, while the connection still showed an x next to it, a new database was created that I could open and examine the tables. I could also locate the database file in my directory, something I can't do when I try with umbraco installed.

    Thanks again for your time.

    Robert

Please Sign in or register to post replies

Write your reply to:

Draft