public static TypeSummary[] BuildSummary(MigrationReport report)
        {
            IDictionary<string, TypeSummary> types = new Dictionary<string, TypeSummary>();

            foreach (MigrationReportMessage message in report.Messages)
            {
                TypeSummary type;
                string sourceType = message.SourceType ?? string.Empty;

                if (!types.TryGetValue(sourceType, out type))
                {
                    type = new TypeSummary(sourceType);
                    types.Add(sourceType, type);
                }

                type.AddMessage(message);
            }

            int typeCount = types.Count;
            string[] keys = new string[typeCount];
            TypeSummary[] values = new TypeSummary[typeCount];
            types.Keys.CopyTo(keys, 0);
            types.Values.CopyTo(values, 0);
            Array.Sort(keys, values);
            return values;
        }
        public void AddReport(MigrationReport report)
        {
            report.Model = this;

            if (_reports != null)
            {
                _reports.Add(report);
            }
        }
        public static IPersistentObject GetPersistentObject(MigrationReport report)
        {
            Guard.ArgumentNotNull(report, "report");
            PersistentObjectAdapterBase adapter;

            if (!_cache.TryGetValue(report, out adapter))
            {
                adapter = new MigrationReportPersistentAdapter(report);
            }

            return adapter;
        }
Example #4
0
 public ExtendedLog(ILog outputLog, MigrationReport report)
 {
     _outputLog = outputLog;
     _report = report;
 }
 public MigrationCompleteEventArgs(MigrationReport report)
 {
     _report = report;
 }
        private void Initialize()
        {
            using (_status.BeginStep("Initializing...", 11))
            {
                if (string.IsNullOrEmpty(_settings.LegacyProject) && _settings.LegacyPlugins.Count == 0)
                {
                    throw new MigrationException("No plugins specified");
                }

                if (!_status.Advance())
                {
                    return;
                }

                bool isNewPackage;
                OrmPackage package = GetPackage(out isNewPackage);

                if (!_status.Advance())
                {
                    return;
                }

                bool isNewPortal;
                PortalApplication portal = GetPortal(out isNewPortal);

                if (!_status.Advance())
                {
                    return;
                }

                BundleManifest manifest = GetBundle();

                if (!_status.Advance())
                {
                    return;
                }

                IVSProject vsProject = (_settings.ProcessScripts
                                            ? GetVSProject()
                                            : null);

                if (!_status.Advance())
                {
                    return;
                }

                CodeDomProvider codeProvider = GetCodeProvider();

                if (!_status.Advance())
                {
                    return;
                }

                StrongNameKeyPair keyPair = GetKeyPair();

                if (!_status.Advance())
                {
                    return;
                }

                ICollection<Plugin> plugins = GetPlugins();

                if (!_status.Advance())
                {
                    return;
                }

                _report = new MigrationReport();
                _report.Date = DateTime.Now;
                _report.Settings = (MigrationSettings) _settings.Clone();

                if (!_status.Advance())
                {
                    return;
                }

                _log = new ExtendedLog(_outputLog, _report);

                if (!_status.Advance())
                {
                    return;
                }

                if (!string.IsNullOrEmpty(_settings.OutputDirectory) && !Directory.Exists(_settings.OutputDirectory))
                {
                    Directory.CreateDirectory(_settings.OutputDirectory);
                }

                if (!_status.Advance())
                {
                    return;
                }

                _contextHolder.Context = new MigrationContext(
                    _settings,
                    package,
                    portal,
                    manifest,
                    vsProject,
                    codeProvider,
                    keyPair,
                    _log,
                    _status,
                    plugins);
                _contextHolder.Context.IsNewPackage = isNewPackage;
                _contextHolder.Context.IsNewPortal = isNewPortal;
            }
        }
 private MigrationReportPersistentAdapter(MigrationReport report)
     : base(report)
 {
     _report = report;
 }
        public void RemoveReport(MigrationReport report)
        {
            report.Model = null;

            if (_reports != null)
            {
                _reports.Remove(report);
            }
        }