Ejemplo n.º 1
0
        public void TestCreateAndFetchEmployeeAndWorkFolder()
        {
            SngTblEmployee   e  = (SngTblEmployee)m_Context.CreateObject(typeof(SngTblEmployee));
            SngTblWorkFolder wf = (SngTblWorkFolder)m_Context.CreateObject(typeof(SngTblWorkFolder));

            e.FirstName      = "Mats";
            e.LastName       = "Helander";
            e.Salary         = 2000;
            e.EmploymentDate = DateTime.Now;
            wf.Name          = "My First Folder";
            wf.Person        = e;
            wf.Employee      = e;
            wf.WorkType      = "Boring";        //ROGER: c'mon , be positive now
            m_Context.Commit();
            m_Context2 = GetContext();
            m_Context2.ExecutingSql += new ExecutingSqlEventHandler(this.m_Context2_ExecutingSql);

            SngTblEmployee e2 = (SngTblEmployee)m_Context2.GetObject(e.Id, typeof(SngTblEmployee));

            Assert.AreEqual("Mats", e2.FirstName);
            Assert.AreEqual("Helander", e2.LastName);
            Assert.AreEqual(2000, e2.Salary);
            SngTblWorkFolder wf2 = (SngTblWorkFolder)m_Context2.GetObject(wf.Id, typeof(SngTblWorkFolder));

            Assert.AreEqual("Boring", wf2.WorkType);
            Assert.AreEqual("Mats", wf2.Employee.FirstName);
            m_Context2.Dispose();
        }
Ejemplo n.º 2
0
        public void AssignManagedObjectOfOtherContextToProperty()
        {
            SngTblWorkFolder wf = (SngTblWorkFolder)m_Context.CreateObject(typeof(SngTblWorkFolder));
            SngTblEmployee   e  = (SngTblEmployee)m_Context2.CreateObject(typeof(SngTblEmployee));

            //this should fail
            wf.Employee = e;
        }
Ejemplo n.º 3
0
 public void AssignUnmanagedObjectToProperty()
 {
     try
     {
         SngTblWorkFolder wf = (SngTblWorkFolder)m_Context.CreateObject(typeof(SngTblWorkFolder));
         //this should fail
         wf.Employee = new SngTblEmployee();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 4
0
        public void TestCreateEmployeeAndWorkFolder()
        {
            SngTblEmployee   e  = (SngTblEmployee)m_Context.CreateObject(typeof(SngTblEmployee));
            SngTblWorkFolder wf = (SngTblWorkFolder)m_Context.CreateObject(typeof(SngTblWorkFolder));

            e.FirstName      = "Mats";
            e.LastName       = "Helander";
            e.Salary         = 2000;
            e.EmploymentDate = DateTime.Now;
            wf.Name          = "My First Folder";
            wf.Person        = e;
            wf.Employee      = e;
            wf.WorkType      = "Boring";
            m_Context.Commit();
        }