Ejemplo n.º 1
0
        public IActionResult OnGet()
        {
            PersonMain personA = new PersonMain()
            {
                ID = 10,
            };

            PersonMain personB = new PersonMain()
            {
                ID = 10,
            };

            bool x = (Person)personA == (Person)personB;

            return(Page());
        }
Ejemplo n.º 2
0
        public void DifferentTablesUseSamePkGenerator_DefaultGeneratorInMainTable()
        {
            using TestDatabase db = CreateTestDatabase();

            IDbSet <PersonMain> setMain = db.Query <PersonMain>().AsDbSet();
            var personMain1             = new PersonMain {
                Name = "Alice Main"
            };
            var personMain2 = new PersonMain {
                Name = "Bob Main"
            };
            var personMain3 = new PersonMain {
                Name = "Connor Main"
            };

            IDbSet <PersonTemp> setTemp = db.Query <PersonTemp>().AsDbSet();
            var personTemp1             = new PersonTemp {
                Name = "Alice Temp"
            };
            var personTemp2 = new PersonTemp {
                Name = "Bob Temp"
            };
            var personTemp3 = new PersonTemp {
                Name = "Connor Temp"
            };

            InsertItems(setMain, personMain1);
            InsertItems(setTemp, personTemp1);
            InsertItems(setMain, personMain2);
            InsertItems(setTemp, personTemp2);
            InsertItems(setMain, personMain3);
            InsertItems(setTemp, personTemp3);

            personMain1.IdA.Should().Be(1);
            personMain2.IdA.Should().Be(3);
            personMain3.IdA.Should().Be(5);
            personTemp1.IdB.Should().Be(2);
            personTemp2.IdB.Should().Be(4);
            personTemp3.IdB.Should().Be(6);
        }