Umbraco Cloud - Entity Framework, Single Custom Table, Store it in its own DB or Within Umbraco's?
c
Hey All, Diving back into some Custom backoffice dashboard where Im creating a bit of an "Admin" area for a baseline project. Reading up on the docs for using EF at Step 3: https://docs.umbraco.com/umbraco-cms/tutorials/getting-started-with-entity-framework-core#step-3-register-the-dbcontext I need to ofcourse register that DB Context, however Im aware Cloud swaps the local development SqlLite DB to an actual SQL DB upon deployment. How would one go about handling the registration of that setup for Cloud? Cheers
j
We do it like this:
Copy code
csharp
services.AddUmbracoEFCoreContext<DealerContext>((options, connectionString, providerName) => options.UseSqlServer(connectionString,
    builder =>
    {
        builder.MigrationsAssembly(typeof(DependencyInjection).Assembly.GetName().FullName);
    }));
The migrationAssembly part is only nessecary if the context is in a seperate project
6 Views