Example #1
0
        public static void Convert(DBHelper dbHelper)
        {
            List <MetaViewInfo> views = new List <MetaViewInfo>();

            using (MetadataContext context = new MetadataContext(dbHelper))
            {
                // Load MetaView and MetaViewPreference objects for each List_* class.
                //Console.WriteLine(DateTime.Now);

                Regex listDetector = new Regex(@"List_\d+");

                MetaClassManager metaClassManager = DataContext.Current.MetaModel;
                foreach (MetaClass metaClass in metaClassManager.MetaClasses)
                {
                    if (listDetector.IsMatch(metaClass.Name))
                    {
                        foreach (MetaView metaView in metaClassManager.GetMetaViews(metaClass))
                        {
                            MetaViewInfo view = new MetaViewInfo();
                            view.Load(metaView);
                            views.Add(view);
                        }
                    }
                }

                // Save ListViewProfile.
                //Console.WriteLine(DateTime.Now);

                foreach (MetaViewInfo view in views)
                {
                    view.SaveListViewProfiles();
                }

                context.Commit();
                //Console.WriteLine(DateTime.Now);
            }
        }
Example #2
0
        public static void Convert(DBHelper dbHelper)
        {
            List<MetaViewInfo> views = new List<MetaViewInfo>();

            using (MetadataContext context = new MetadataContext(dbHelper))
            {
                // Load MetaView and MetaViewPreference objects for each List_* class.
                //Console.WriteLine(DateTime.Now);

                Regex listDetector = new Regex(@"List_\d+");

                MetaClassManager metaClassManager = DataContext.Current.MetaModel;
                foreach (MetaClass metaClass in metaClassManager.MetaClasses)
                {
                    if (listDetector.IsMatch(metaClass.Name))
                    {
                        foreach (MetaView metaView in metaClassManager.GetMetaViews(metaClass))
                        {
                            MetaViewInfo view = new MetaViewInfo();
                            view.Load(metaView);
                            views.Add(view);
                        }
                    }
                }

                // Save ListViewProfile.
                //Console.WriteLine(DateTime.Now);

                foreach (MetaViewInfo view in views)
                {
                    view.SaveListViewProfiles();
                }

                context.Commit();
                //Console.WriteLine(DateTime.Now);
            }
        }