Copied to clipboard

Flag this post as spam?

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


  • René 3 posts 73 karma points
    5 days ago
    René
    0

    EF Core, DBContext and Umbraco 10

    I have run into a problem when i am using "Microsoft.EntityFrameworkCore.SqlServer"

    I add my DBContext like this to startup

    "services.AddDbContext<DataContext>(options => options.UseSqlServer(_config.GetConnectionString("umbracoDbDSN")));"
    

    Then umbraco DB connection fails and Umbraco returns to showing install page any thoughts on why ?

    I need to access custom tables with EF

  • Lotte Pitcher 49 posts 242 karma points MVP 6x c-trib
    4 days ago
    Lotte Pitcher
    0

    Hi René,

    I know I'm not solving your actual problem but could you use a separate SQL database for EF? That was the approach I took and managed to get things wired up ok!

    Just a thought :)

    Lotte

  • René 3 posts 73 karma points
    3 days ago
    René
    0

    Any ideas are welcome :)

    so yes i could use a setup where i just use another DB to store my custom tables in.

  • Lotte Pitcher 49 posts 242 karma points MVP 6x c-trib
    3 days ago
    Lotte Pitcher
    0

    There are people who believe that using a separate database for non umbraco data is the safer / right approach to take anyway! At least then you know that Umbraco migrations and EF migrations would never have any conflict. Good luck :)

  • René 3 posts 73 karma points
    3 days ago
    René
    0

    I actually thought you had a solution you wanted to share?, because I still have problems using the

    "Microsoft.EntityFrameworkCore.SqlServer"

    package, when I install that package it's a bit like there is a conflict and umbraco doesn't know how to use the UmbracoDBDSN connection string and goes directly to the install umbraco page.

    so do you have a running example where you connect to two DB´s ? if so can you tell me how you did it without this "conflict" using "Microsoft.EntityFrameworkCore.SqlServer"

  • Biagio Paruolo 1541 posts 1725 karma points c-trib
    2 days ago
    Biagio Paruolo
    0

    Hi,

    you have to use a separate connection string and context for your EF and you have to use the same Umbraco package version of Microsoft.EntityFrameworkCore.SqlServer.

Please Sign in or register to post replies

Write your reply to:

Draft