internal static void RegisterCmdLine(ContainerBuilder builder) { builder .RegisterCmdLineAction("generate", "generates and compiles new data classes", scope => { scope.Resolve<Compiler>().GenerateCode(); }); builder .RegisterCmdLineAction("compile", "[DEVEL] compiles new data classes from already generated code; used mostly for testing", scope => { scope.Resolve<Compiler>().CompileCode(); }); }
protected override void Load(ContainerBuilder moduleBuilder) { base.Load(moduleBuilder); moduleBuilder.RegisterModule<Zetbox.App.Projekte.Common.CustomCommonActionsModule>(); moduleBuilder.RegisterZetboxImplementors(typeof(CustomServerActionsModule).Assembly); // Register explicit overrides here moduleBuilder.RegisterCmdLineAction("rebuildtags", "Recreates the tag cache", scope => { using (var ctx = scope.Resolve<IZetboxServerContext>()) { var oneTag = ctx.GetQuery<Zetbox.App.GUI.TagCache>().FirstOrDefault(); if (oneTag == null) { oneTag = ctx.Create<Zetbox.App.GUI.TagCache>(); } oneTag.Rebuild(); if (string.IsNullOrWhiteSpace(oneTag.Name)) ctx.Delete(oneTag); ctx.SubmitChanges(); } }); moduleBuilder .RegisterType<Zetbox.App.Projekte.Server.Gui.TagCacheService>() .AsImplementedInterfaces() .SingleInstance(); }
protected override void Load(ContainerBuilder builder) { base.Load(builder); builder .Register<ScreenshotTool>(c => new ScreenshotTool()) .As<IScreenshotTool>() .SingleInstance(); builder .RegisterCmdLineAction("register-pseudo-culture", "Installs the pseudo culture de-PZ with the current cultures defaults. Must be run with elevated windows priviledges. Don't forget to restart Visual Studio to apply the new culture.", scope => { CultureAndRegionInfoBuilder cib = new CultureAndRegionInfoBuilder("x-zb-Pseudo", CultureAndRegionModifiers.None); cib.LoadDataFromCultureInfo(CultureInfo.CurrentCulture); cib.LoadDataFromRegionInfo(RegionInfo.CurrentRegion); cib.Register(); Logging.Server.Info("pseudo-culture sucessfully registered."); }); }
internal static void RegisterCommon(ContainerBuilder builder) { builder .RegisterCmdLineAction("generate", "generates and compiles new data classes", scope => { scope.Resolve<Compiler>().GenerateCode(); }); builder .RegisterCmdLineAction("generate-fallback", "generates and compiles fallback classes", scope => { scope.Resolve<Compiler>().GenerateFallback(); }); builder .RegisterCmdLineAction("compile", "[DEVEL] compiles new data classes from already generated code; used mostly for testing", scope => { scope.Resolve<Compiler>().CompileCode(); }); builder .RegisterCmdLineListAction("generate-resources:", "generates resources for the given modules or * or empty for all modules", (scope, arg) => { if (arg == null || arg.Length == 0) arg = new string[] { "*" }; scope.Resolve<ResourceCmdLineHandler>().Generate(arg); }); builder .RegisterType<ResourceCmdLineHandler>() .AsSelf() .InstancePerDependency(); builder .RegisterType<Zetbox.Generator.ResourceGenerator.ResourceGenerator>() .As<IResourceGenerator>() .InstancePerDependency(); #region Register resource tasks builder .RegisterType<DataTypeTask>() .As<IResourceGeneratorTask>() .SingleInstance(); builder .RegisterType<CategoryTagTask>() .As<IResourceGeneratorTask>() .SingleInstance(); builder .RegisterType<ModuleTask>() .As<IResourceGeneratorTask>() .SingleInstance(); builder .RegisterType<ApplicationTask>() .As<IResourceGeneratorTask>() .SingleInstance(); builder .RegisterType<NavigationEntriesTask>() .As<IResourceGeneratorTask>() .SingleInstance(); #endregion }
protected override void Load(ContainerBuilder builder) { base.Load(builder); builder .Register<ServerDeploymentRestrictor>(c => new ServerDeploymentRestrictor()) .As<IDeploymentRestrictor>() .SingleInstance(); builder .RegisterType<Migration.MigrationTasksBase>() .As<Migration.IMigrationTasks>() .InstancePerDependency(); builder .RegisterModule<Log4NetAppender.Module>(); builder .RegisterType<PerfCounterDispatcher>() .As<IPerfCounter>() .OnActivated(args => args.Instance.Initialize(args.Context.Resolve<IFrozenContext>())) .OnRelease(obj => obj.Dump()) .SingleInstance(); builder .RegisterAssemblyTypes(typeof(ServerApiModule).Assembly) .AssignableTo<Option>() .As<Option>() .InstancePerLifetimeScope(); builder .RegisterCmdLineDataOption("schemamodules=", "A semicolon-separated list of schema-defining modules to export", SchemaModulesKey); builder .RegisterCmdLineDataOption("ownermodules=", "A semicolon-separated list of data-owning modules to export", OwnerModulesKey); builder .RegisterCmdLineAction("deploy=", "deploy the database from the specified xml file", (scope, arg) => { Logging.Server.Warn("Option deploy with arguments is depricated, migrate to new deployment strategy"); scope.Resolve<IServer>().Deploy(arg); }); builder .RegisterCmdLineAction("deploy-local:", "deploy all modules from the local Modules directory", (scope, arg) => { var srv = scope.Resolve<IServer>(); srv.Deploy(Directory.GetFiles(arg ?? "Modules", "*.xml", SearchOption.TopDirectoryOnly)); }); builder .RegisterCmdLineAction("deploy-update", "update the database from all files in Module directory, deployes them and generates", (scope, arg) => { scope.Resolve<IServer>().Deploy(); }); builder .RegisterCmdLineAction("import=", "import the database from the specified xml file", (scope, arg) => { scope.Resolve<IServer>().Import(arg); }); builder .RegisterCmdLineAction("export=", "export the database to the specified xml file. Select the exported data with -schemamodules and -ownermodules", (scope, arg) => { var config = scope.Resolve<ZetboxConfig>(); string[] schemaModulesArray; string[] ownerModulesArray; ParseModules(config, out schemaModulesArray, out ownerModulesArray); scope.Resolve<IServer>().Export( arg, schemaModulesArray, ownerModulesArray); }); builder .RegisterCmdLineAction("publish=", "publish the specified modules to this xml file. Select the exported data with -ownermodules", (scope, arg) => { var config = scope.Resolve<ZetboxConfig>(); string[] schemaModulesArray; string[] ownerModulesArray; ParseModules(config, out schemaModulesArray, out ownerModulesArray); scope.Resolve<IServer>().Publish( arg, ownerModulesArray); }); builder .RegisterCmdLineAction("checkdeployedschema", "checks the sql schema against the deployed schema", scope => { scope.Resolve<IServer>().CheckSchema(false); }); builder .RegisterCmdLineAction("checkschema=", "checks the sql schema against the metadata (parameter 'meta') or a specified xml file", (scope, arg) => { if (arg == "meta") { scope.Resolve<IServer>().CheckSchemaFromCurrentMetaData(false); } else { scope.Resolve<IServer>().CheckSchema(new[] { arg }, false); } }); builder .RegisterCmdLineAction("repairschema", "checks the schema against the deployed schema and tries to correct deviations", scope => { scope.Resolve<IServer>().CheckSchema(true); }); builder .RegisterCmdLineAction("updatedeployedschema", "updates the schema to the current metadata", scope => { scope.Resolve<IServer>().UpdateSchema(); }); builder .RegisterCmdLineListAction("updateschema=", "updates the schema to the specified xml file(s)", (scope, args) => { scope.Resolve<IServer>().UpdateSchema(args); }); builder .RegisterCmdLineAction("syncidentities", "synchronices local and domain users with Zetbox Identities", scope => { scope.Resolve<IServer>().SyncIdentities(); }); builder .RegisterCmdLineAction("analyze=", "analyzes the configured database", (scope, arg) => { scope.Resolve<IServer>().AnalyzeDatabase(arg, File.CreateText(string.Format("{0} Report.txt", arg))); }); builder .RegisterCmdLineAction("installperfcounter", "Installs/Reinstalls the perfomance counters", scope => { scope.Resolve<IPerfCounter>().Install(); }); builder .RegisterCmdLineAction("uninstallperfcounter", "Uninstalls the perfomance counters", scope => { scope.Resolve<IPerfCounter>().Uninstall(); }); builder .RegisterCmdLineAction("benchmark", "[DEVEL] run ad-hoc benchmarks against the database", scope => { scope.Resolve<IServer>().RunBenchmarks(); }); builder .RegisterCmdLineAction("fix", "[DEVEL] run ad-hoc fixes against the database", scope => { scope.Resolve<IServer>().RunFixes(); }); builder .RegisterCmdLineAction("wipe", "[DEVEL] completely wipe the contents of the database", scope => { scope.Resolve<IServer>().WipeDatabase(); }); builder .RegisterCmdLineListAction("recalc-all:", "Recalculate calculated properties. This may be needed if the implementation has changed and no proper migration is in place. If no ; seperated list of properties is provided, all properties will be recalculated. e.g -recalc-all or -recalc-all=module.objclass.prop;module.objclass.prop2", (scope, args) => { if (args == null || args.Length == 0) { // recalculate all scope.Resolve<IServer>().RecalculateProperties(null); } else { var ctx = scope.Resolve<IZetboxServerContext>(); var properties = ParseProperties(args, ctx); scope.Resolve<IServer>().RecalculateProperties(properties.ToArray()); } }); }