public void Run(string manifestPath, CdsConnection cdsConnection)
        {
            var manifest = SerialisationWrapper.DeserialiseFromFile <ProcessActivationManifest>(manifestPath);
            var client   = XrmClient.GetCrmServiceClientFromManifestConfiguration(manifest.CdsConnection);

            ValidateManifest(manifest);
            if (!ValidationResult.IsValid)
            {
                // TODO - throw a good error ;)
                return;
            }

            if (manifest.LoggingConfiguration == null)
            {
                manifest.LoggingConfiguration = new LoggingConfiguration()
                {
                    LoggerConfigurationType = LoggerConfigurationType.Console,
                    LogLevelToTrace         = LogLevel.Information
                };
            }

            var processWrapper = new ProcessActivationWrapper();

            processWrapper.SetStatusFromManifest(client, manifest);
        }
예제 #2
0
        public void Run(string manifestPath, CdsConnection cdsConnection)
        {
            // TODO - throw good errors if manifest can't be found/read/isInvalid
            var manifest = SerialisationWrapper.DeserialiseFromFile <ConfigurationManifest>(manifestPath);
            // TODO - throw good error if XrmClient is unauthorised/etc...
            var client = XrmClient.GetCrmServiceClientFromManifestConfiguration(manifest.CdsConnection);

            ValidateManifest(manifest);
            if (!ValidationResult.IsValid)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"Manifest is not valid. Not progressing with registration");
                Console.WriteLine($"\nErrors found in manifest validation:\n{ValidationResult}");
                Console.ResetColor();

                // QUESTION - Do you really want to throw an exception here, if you're already logging the val output?
                throw new InvalidManifestException("Exiting processing with exception - Manifest is not valid");
            }

            if (manifest.LoggingConfiguration == null)
            {
                manifest.LoggingConfiguration = new LoggingConfiguration()
                {
                    LoggerConfigurationType = LoggerConfigurationType.Console,
                    LogLevelToTrace         = LogLevel.Information
                };
            }

            var configWrapper = new ConfigurationWrapper();

            configWrapper.GenerateCustomisations(manifest, client);
        }
        public void Run(string manifestPath, CdsConnection cdsConnection)
        {
            var manifest = SerialisationWrapper.DeserialiseFromFile <PluginManifest>(manifestPath);

            if (cdsConnection != null)
            {
                manifest.CdsConnection = cdsConnection;
            }

            ValidateManifest(manifest);
            if (!ValidationResult.IsValid)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"Manifest is not valid. Not progressing with registration");
                Console.WriteLine($"\nErrors found in manifest validation:\n{ValidationResult}");
                Console.ResetColor();

                throw new InvalidManifestException("Exiting processing with exception - Manifest is no valid");
            }

            if (manifest.LoggingConfiguration == null)
            {
                manifest.LoggingConfiguration = new LoggingConfiguration()
                {
                    LoggerConfigurationType = LoggerConfigurationType.Console,
                    LogLevelToTrace         = LogLevel.Information
                };
            }

            var client = XrmClient.GetCrmServiceClientFromManifestConfiguration(manifest.CdsConnection);

            var pluginWrapper = new PluginWrapper();

            pluginWrapper.RegisterPlugins(manifest, client);
            pluginWrapper.RegisterServiceEndpoints(manifest, client);
        }