Hi all! (Especially Morten who wrote one of the first examples of a console app with Umbraco for v6 and v7)
We wrote a console app which runs fluent migrator to migrate content, doc types properties etc for umbraco in v7 I'm porting it to v8 and would appreciate some help on understanding what has replaced corebootmanager and kicking the app off.
This is the v7 code and in particular working out how to boostrap the console app
/// <summary>
/// Extends the CoreBootManager for use in this Console app.
/// </summary>
public class ConsoleBootManager : CoreBootManager
{
public ConsoleBootManager(UmbracoApplicationBase umbracoApplication, string baseDirectory)
: base(umbracoApplication)
{
//This is only here to ensure references to the assemblies needed for the DataTypesResolver
//otherwise they won't be loaded into the AppDomain.
// Migration originally targeted a previous version of Umbraco so obosolete
var interfacesAssemblyName = typeof(IDataType).Assembly.FullName;
// Type or member is obsolete
var editorControlsAssemblyName = typeof(uploadField).Assembly.FullName;
base.InitializeApplicationRootPath(baseDirectory);
}
/// <summary>
/// Can be used to initialize our own Application Events
/// </summary>
protected override void InitializeApplicationEventsResolver()
{
base.InitializeApplicationEventsResolver();
}
/// <summary>
/// Can be used to add custom resolvers or overwrite existing resolvers once they are made public
/// </summary>
protected override void InitializeResolvers()
{
base.InitializeResolvers();
}
}
As far as I researched creating a console application to do some one-time data processing does not work anymore. Or there is no documentation for it available yet.
Instead I've used the following to hook into Umbraco V8 Web application to execute my migration code including access to the Umbraco API:
Here is my example code for importing some Wordpress posts by using the above concept:
using Umbraco.Core.Composing;
/// <summary>
/// Registeres component in Umbraco automatically
/// Starts import of some WordPress posts
/// </summary>
public class MyComposer : ComponentComposer<MyComponent>
{
}
public class MyComponent : IComponent
{
// Initialize: runs once when Umbraco starts
public void Initialize()
{
var contentService = Current.Services.ContentService;
var logger = Current.Logger;
var sqlContext = Current.SqlContext;
var contentGridConverter = new ContentGridConverter();
var wordpressArticleWpContentReplacer = new WordpressArticleWpContentReplacer();
var myImporter = new myImporter(contentService, logger, contentGridConverter, wordpressArticleWpContentReplacer, sqlContext);
myImporter.Import();
}
// Terminate: runs once when Umbraco stops
public void Terminate()
{
}
}
you can see how everything is wired up then you can get services. Note this is only for umbraco services you cannot do anything with IPublishedContent etc but if you want to create content / media then this works fine.
MORTEN!! - Umbraco 8 - Console App - CoreBootManager - UmbracoApplicationBase
Hi all! (Especially Morten who wrote one of the first examples of a console app with Umbraco for v6 and v7)
We wrote a console app which runs fluent migrator to migrate content, doc types properties etc for umbraco in v7 I'm porting it to v8 and would appreciate some help on understanding what has replaced corebootmanager and kicking the app off.
This is the v7 code and in particular working out how to boostrap the console app
// Migration originally targeted a previous version of Umbraco so obosolete var interfacesAssemblyName = typeof(IDataType).Assembly.FullName; // Type or member is obsolete var editorControlsAssemblyName = typeof(uploadField).Assembly.FullName;
Hi, I am trying to create console application with umbraco 8. until now i don't understand how to do this.
please some help :)
thanks
As far as I researched creating a console application to do some one-time data processing does not work anymore. Or there is no documentation for it available yet.
Instead I've used the following to hook into Umbraco V8 Web application to execute my migration code including access to the Umbraco API:
Umbraco Documentation about Composing & Registering Components
Here is my example code for importing some Wordpress posts by using the above concept:
I am also looking for umbraco 8 console application. CoreBootManager has gone from umbraco 8 to initialise application.
IN v8 use https://github.com/callumbwhyte/sidecar I have used it see
https://github.com/callumbwhyte/sidecar/blob/master/src/Sidecar.ConsoleApp/Program.cs
you can see how everything is wired up then you can get services. Note this is only for umbraco services you cannot do anything with IPublishedContent etc but if you want to create content / media then this works fine.
@Ismail how are you using https://github.com/callumbwhyte/sidecar ?? I try it but Im getting the no factory error
I am also trying to create console application with umbraco 8. watched many youtube video but not getting what to do
if you have any solution please help me
is working on a reply...