Hello everyone in the fabulous Umbraco community. I hope you have had a safe and happy holiday (Christmas for those of you that celebrate it) and my best wishes go out to you all for the new year.
I'm kicking off 2021 with a major upgrade of our main corporate website to Umbraco 8. Cloud is also on the cards, but first I have a ton of legacy data to contend with.
I have successfully managed to get Migrations working but was wondering why the Database method is no longer working in the ApplicationContext. I have been repeatedly getting a object reference error, but the inner exception doesn't shed any light on what's causing it. This error prevents a database entry of the product-name-upgrade and semversion in the migrations table.
To remedy the problem I have used the UmbracoDatabase object to new up an instance of an Umbraco Database and this seems to work fine, but it took days of searching and digging around before I found this. So it would seem this is not a widely known or documented issue.
As with all things Umbraco, over the years I have found setups, configurations and code can vary wildly from project-to-project and version-to-version, so I'm happy to accept it could be my project that is at fault. So here are some tidbits of information about my own project that may shed some light on my issue.
Umbraco version 7.15.6
Autofac enabled and in-use
ModelsBuilder enabled and in-use
Local build VS2019/MSSQL-LocalDB/IIS Express
Here's my event handler code that is working, using the alternative approach I stumbled across but isn't widely documented. Incidentally, The Our.Umbraco.Migrations project suffers the same issue as it too calls the Database method from ApplicationContext.
Umbraco Migrations v7.15.x
Hello everyone in the fabulous Umbraco community. I hope you have had a safe and happy holiday (Christmas for those of you that celebrate it) and my best wishes go out to you all for the new year.
I'm kicking off 2021 with a major upgrade of our main corporate website to Umbraco 8. Cloud is also on the cards, but first I have a ton of legacy data to contend with.
I have successfully managed to get Migrations working but was wondering why the Database method is no longer working in the ApplicationContext. I have been repeatedly getting a object reference error, but the inner exception doesn't shed any light on what's causing it. This error prevents a database entry of the product-name-upgrade and semversion in the migrations table.
To remedy the problem I have used the UmbracoDatabase object to new up an instance of an Umbraco Database and this seems to work fine, but it took days of searching and digging around before I found this. So it would seem this is not a widely known or documented issue.
As with all things Umbraco, over the years I have found setups, configurations and code can vary wildly from project-to-project and version-to-version, so I'm happy to accept it could be my project that is at fault. So here are some tidbits of information about my own project that may shed some light on my issue.
Umbraco version 7.15.6 Autofac enabled and in-use ModelsBuilder enabled and in-use
Local build VS2019/MSSQL-LocalDB/IIS Express
Here's my event handler code that is working, using the alternative approach I stumbled across but isn't widely documented. Incidentally, The Our.Umbraco.Migrations project suffers the same issue as it too calls the Database method from ApplicationContext.
is working on a reply...