Closed juchom closed 4 years ago
Ok, thanks for posting here. Was too much to see what you were doing on gitter.
I think the approach is wrong. I would suggest adding the dependencies to your Manifest.cs
[assembly: Module(
Name = "MyWebsite Base Module",
Author = "MyWebsite",
Website = "",
Version = "0.1",
Description = "MyWebsite Base Module",
Category = "MyWebsite"
Dependencies = new string[] { which ever modules you are reliant on here. }
)]
This should correctly order your dependencies, and activate them from the main recipe, as this module is activated there.
Doing this suppose that I know what I need in advance, which is not the case.
I try to find a way to work with Orchard with other developers.
Starting a new project from the blank recipe, I thought I could create an empty module, create a startup recipe with it enabled by default.
Then each time I update my orchard configuration or content definitions, I would export it, version the migration in my module and deploy it at startup (a bit like entity framework).
Using modules may not by the right place to do it, but I can't figure out how to do this.
@juchom
Yes, as suggested by @deanmarcussen you still need to update the manifest if your module has new dependencies relying on the services of another new module.
If, after updating the manifest dependencies, it still doesn't work, for infos i'm working on the following
There are some related issues in the sense that there are all using custom migrations recipes e.g. #7449, #7557. For some good reasons (e.g. database issues as yours), normally when executing a recipe, each recipe step is executed in its own scope, which is not the case of a migration recipe. Originaly, migrations and then migrations recipes were intended to only update the type definition table (as we are doing in the regular migation classes), but yes it is useful to automatically do other things through recipe steps when enabling a feature.
Your issue as seen on gitter
SqliteException: SQLite Error 1: 'no such table: AutoroutePartIndex'.
So, i will work on a more global solution related to the scopes of migraion recipes.
Thanks for your replies,
So when enabling a feature in Orchard, I export it as a recipe in my module and I also add it to the Dependencies in Manifest.cs, I can run from scratch the whole module & migrations.
Thanks a lot for your help!
and I also add it to the Dependencies in Manifest.cs
Normally only the one your module relies on
Okay so i close this issue, feel free to re-open another issue if you have any other problem ;)
Hello,
The solution of using Dependencies works fine when enabling features.
When disabling a feature I can't use anymore the Dependencies and I face the same issue.
I'm hitting an issue with this scenario.
Create a VS solution with two projects: ASP.Net Empty project -> MyWebsite.Backend Class Library (.net core) -> MyWebsite.Backend.BaseModule
Here is MyWebsite.Backend files:
MyWebsite.Backend.csproj
Program.cs
Startup.cs
Add a folder Recipes and the following file mywebsite.recipe.json
In BaseModule project
MyWebsite.Backend.BaseModule.csproj
Manifest.cs
STOP HERE: and run the project, everything works fine and we can see that our module is enabled.
Now add this code to the BaseModule project
Startup.cs
Add a folder Migrations
add in this folder
Migrator.cs
0001_enableauthfeatures.json (we enable OrchardCore.Microsoft.Authentication.AzureAD & OrchardCore.Users.Registration)
STOP HERE: run the project again, you will see our two modules enabled.
LAST STEP: Delete App_Data folder and run the whole things, it will throws when creating the site.