Exemple #1
0
        /// <summary>
        /// Initialize the buckets and catalog data table from metadata
        /// </summary>
        /// <returns></returns>
        public bool InitializeFromMetadata()
        {
            try
            {
                //catalog tables
                foreach (ITableMetadata table_metadata in CatalogMetadata.Tables.Values)
                {
                    //create our catalog level table
                    DataTable table;
                    if (table_metadata.ReferenceTable)
                        table = new ReferenceDataTable(this, table_metadata);
                    else
                        table = new CatalogDataTable(this, table_metadata);
                    
                    //add to the catalog
                    CatalogDataTables.Add(table_metadata.TableName, table);
                }
                //buckets
                for (int x = 0; x < ComputeNode.GlobalBucketCount; x++)
                {
                    //check for our mod
                    if (x % ComputeNode.ComputeNodeCount == ComputeNode.ComputeNodeIndex)
                    {
                        //make a bucket
                        Bucket bucket = new Bucket(this);
                        Buckets.Add(x, bucket);
                        bucket.BucketMod = x;

                        //parse the metadata
                        foreach (ITableMetadata table_metadata in CatalogMetadata.Tables.Values.Where(t => t.ReferenceTable == false))
                        {
                            //create our bucket level table
                            IRelationshipMetadata relationship_metadata = CatalogMetadata.Relationships.Values.Where(r => r.RelationTable == table_metadata).FirstOrDefault();
                            IBucketDataTable table;
                            if (relationship_metadata != null)
                                table = new RelationshipDataTable(bucket, table_metadata, relationship_metadata);
                            else
                                table = new BucketDataTable(bucket, table_metadata);
                            
                            //add to our bucket
                            bucket.BucketDataTables.Add(table_metadata.TableName, table);
                        }
                    }
                }
                //mark as initialized
                Initialized = true;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
                return false;
            }
            return true;
        }
Exemple #2
0
        /// <summary>
        /// Initialize the buckets and catalog data table from metadata
        /// </summary>
        /// <returns></returns>
        public bool InitializeFromMetadata()
        {
            try
            {
                //catalog tables
                foreach (ITableMetadata table_metadata in CatalogMetadata.Tables.Values)
                {
                    //create our catalog level table
                    DataTable table;
                    if (table_metadata.ReferenceTable)
                    {
                        table = new ReferenceDataTable(this, table_metadata);
                    }
                    else
                    {
                        table = new CatalogDataTable(this, table_metadata);
                    }

                    //add to the catalog
                    CatalogDataTables.Add(table_metadata.TableName, table);
                }
                //buckets
                for (int x = 0; x < ComputeNode.GlobalBucketCount; x++)
                {
                    //check for our mod
                    if (x % ComputeNode.ComputeNodeCount == ComputeNode.ComputeNodeIndex)
                    {
                        //make a bucket
                        Bucket bucket = new Bucket(this);
                        Buckets.Add(x, bucket);
                        bucket.BucketMod = x;

                        //parse the metadata
                        foreach (ITableMetadata table_metadata in CatalogMetadata.Tables.Values.Where(t => t.ReferenceTable == false))
                        {
                            //create our bucket level table
                            IRelationshipMetadata relationship_metadata = CatalogMetadata.Relationships.Values.Where(r => r.RelationTable == table_metadata).FirstOrDefault();
                            IBucketDataTable      table;
                            if (relationship_metadata != null)
                            {
                                table = new RelationshipDataTable(bucket, table_metadata, relationship_metadata);
                            }
                            else
                            {
                                table = new BucketDataTable(bucket, table_metadata);
                            }

                            //add to our bucket
                            bucket.BucketDataTables.Add(table_metadata.TableName, table);
                        }
                    }
                }
                //mark as initialized
                Initialized = true;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
                return(false);
            }
            return(true);
        }