Example #1
0
        static Form1()
        {
            // The following code is required to support serialization of multiple custom objects.
            TypeDescriptor.AddAttributes(typeof(XPCollection), new ReportAssociatedComponentAttribute());

            // The following code is required to serialize custom objects.
            ReportExtension.RegisterExtensionGlobal(new ReportExtension());
            ReportDesignExtension.RegisterExtension(new DesignExtension(), ExtensionName);

            string fileName =
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\person.mdb";

            if (!File.Exists(fileName))
            {
                UnitOfWork session = CreateSessionByName("person.mdb");
                if (new XPCollection <Person>(session).Count < 6)
                {
                    Person.Create(session, "Name1");
                    Person.Create(session, "Name2");
                    Person.Create(session, "Name3");
                    Person.Create(session, "Name4");
                    Person.Create(session, "Name5");
                    Person.Create(session, "Name6");
                    session.CommitChanges();
                }
            }
        }
Example #2
0
        static Form1()
        {
            // The following code is required to support serialization of multiple custom objects.
            TypeDescriptor.AddAttributes(typeof(DataSet), new ReportAssociatedComponentAttribute());
            TypeDescriptor.AddAttributes(typeof(OleDbDataAdapter), new ReportAssociatedComponentAttribute());

            // The following code is required to serialize custom objects.
            ReportExtension.RegisterExtensionGlobal(new ReportExtension());
            ReportDesignExtension.RegisterExtension(new DesignExtension(), ExtensionName);
        }