I'm struggling following the basic tutorial for Elsa with Ef-Core/SQL persistence. At runtime, the application fails with error clearly pointing to a lack of certain tables. I'm using Elsa as embedded into my API. I have my own DbContext. I need else to live in my database. But Update Database
doesn't work reporting multiple context and I have to specify mine for my changes.
Q: What is Elsa's context?
A: ?
Q: How do I create the tables for Elsa in my database?
A: ?
Q: What is this environment variable EF_CONNECTIONSTRING and why is this needed?
A: ?
Thanks.
Update
So, I managed to unearth a few mode things... my questions were:
Q: What is Elsa's context?
A: SqlServerContext
Q: How do I create the tables for Elsa in my database?
A: Update-Database -context SqlServerContext
Q: What is this environment variable EF_CONNECTIONSTRING and why is this needed?
A: This one, I'm struggling with. I get an error if I just run Update-Database -context SqlServerContext
: Set the EF_CONNECTIONSTRING environment variable to a valid SQL Server connection string.
Why? I have the connection injected:
services.AddElsa(elsa => elsa.AddEntityFrameworkStores<SqlServerContext>(options => options.UseSqlServer(Configuration.GetConnectionString("PrimaryConnection"))))
Why Do I have to set a system variable to get Elsa working?
It seems you've got most of the answers but for the environment variable, you have provided the connection string in the startup's configure method which is executed on the Runtime and Update-Database command in the package manager console does not run the application so it doesn't know about the connection string and we have to provide it using the environment variable.