Exemplo n.º 1
0
        /// <summary>
        /// Called When the package is initialized.
        /// </summary>
        public override void InitializeCustomExtension()
        {
            if (RuntimeSettings != null)
            {
                //RuntimeSettings.Add("CommonDataModelNonprofitSampleAppsBase", "true");
                PackageLog.Log(string.Format("Runtime Settings populated.  Count = {0}", RuntimeSettings.Count));

                foreach (var setting in RuntimeSettings)
                {
                    PackageLog.Log(string.Format("Key={0} | Value={1}", setting.Key, setting.Value.ToString()));
                }

                int[] version     = GetSolutionVersion("NonprofitCore");
                bool? installCore = GetRuntimeSetting("NonprofitCore");
                if (installCore == true && version != null && version[0] < 3 && version[1] < 3)
                {
                    PackageLog.Log("Older version of the Core found adding sample app base solution.");
                    RuntimeSettings.Add("CommonDataModelNonprofitSampleAppsBase", "true");
                }
                else
                {
                    PackageLog.Log("New install detected no sample app base install required.");
                    RuntimeSettings.Add("CommonDataModelNonprofitSampleAppsBase", "false");
                }

                if (RuntimeSettings.ContainsKey("SkipSampleData"))
                {
                    bool sample = false;
                    if (bool.TryParse((string)RuntimeSettings["SkipSampleData"], out sample))
                    {
                        DataImportBypass = sample;
                    }
                }
            }
            else
            {
                // Skip sample data by default
                DataImportBypass = true;
            }
        }
Exemplo n.º 2
0
        public async Task InitializeAsync(AppAnalyzer app)
        {
            Name    = app.Name;
            AppType = app.App.GetType();
            foreach (var p in app.Parameters)
            {
                Parameters.Add(new Parameter {
                    Description = p.Description,
                    Mandatory   = p.Mandatory,
                    Name        = p.Name,
                    Type        = p.ParameterType,
                    Value       = p.Get()
                });
            }

            foreach (var dep in app.Dependencies)
            {
                var m = new ConfigureAppModel();
                await m.InitializeAsync(dep);

                Dependencies.Add(m);
            }

            var appBuilder = new AppBuilder();
            await app.Build(appBuilder);

            foreach (var svc in appBuilder.BuiltApp.Services)
            {
                RuntimeSettings.Add(
                    new ServiceRuntimeSettings {
                    Name     = svc.Name,
                    Scalable = svc.ScalabilityModel == ScalabilityModel.Scalable,
                    Scale    = 1,
                });
            }
        }