public List <DatabaseInstance> GenerateDatabaseInstances(ServerInstance[][] serverInstances, string namePattern, string databaseNamePattern, double sizeFactor, bool generateFileGroups)
        {
            List <DatabaseInstance> instances = new List <DatabaseInstance>();

            databaseDefinition.LoadDatabaseVersions(false);
            databaseDefinition.LoadSlices(false);

            List <Slice> slices = new List <Slice>(databaseDefinition.Slices.Values.OrderBy(i => i.Number));

            for (int si = 0; si < slices.Count; si++)
            {
                Slice slice = slices[si];
                // **** TODO review this part and add [$Number] to pattern if mirrored
                // to avoid name collision under databaseinstance
                foreach (DatabaseVersion rs in databaseDefinition.DatabaseVersions.Values)
                {
                    // TODO: do not use rs.Number here!!!
                    DatabaseInstance ndi = GenerateDatabaseInstance(serverInstances[si][rs.Number], slices[si], rs, namePattern, databaseNamePattern, sizeFactor, generateFileGroups);

                    instances.Add(ndi);
                }
            }

            return(instances);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            item      = new DatabaseDefinition(RegistryContext);
            item.Guid = new Guid(Request.QueryString["guid"]);
            item.Load();

            item.LoadDatabaseVersions(false);
            databaseVersions = new List <DatabaseVersion>(item.DatabaseVersions.Values);
            if (!IsPostBack)
            {
                RefreshDatabaseVersionList();
            }

            // Load currently selected database version
            databaseVersion      = new DatabaseVersion(RegistryContext);
            databaseVersion.Guid = new Guid(databaseVersionList.SelectedValue);
            databaseVersion.Load();

            // Load server instances
            EntityFactory ef = new EntityFactory(RegistryContext);

            serverInstances = new List <ServerInstance>(ef.FindAll <ServerInstance>()
                                                        .Where(i => i.ServerVersionReference.Guid == databaseVersion.ServerVersionReference.Guid)
                                                        .OrderBy(i => i.Machine.Number));

            // Load slices
            item.LoadSlices(false);
            slices = new List <Slice>(item.Slices.Values);

            if (!IsPostBack)
            {
                UpdateForm();
            }

            GenerateTable();
        }