RemoveRange Error?

Sep 25, 2009 at 3:52 AM
Edited Sep 25, 2009 at 3:54 AM

this maybe an Error?

if this method RemoveRangeConditionTest() change like this code:

        private void RemoveRangeConditionTest()
        {
            Database.DeleteDatabase("test");
            Database db = Database.CreateDatabase("test");
            db.CreateTable<Person>();

            Person person1 = new Person() { FirstName = "John ", LastName = "Doe ", Salary = 1, BirthDate = new DateTime(1900, 1, 1) };
            Person person2 = new Person() { FirstName = "John ", LastName = "Doe ", Salary = 2, BirthDate = new DateTime(1900, 1, 1) };
            Person person3 = new Person() { FirstName = "John ", LastName = "Doe ", Salary = 3, BirthDate = new DateTime(1900, 1, 1) };

            db.Table<Person>().Add(person1);
            db.Table<Person>().Add(person2);
            db.Table<Person>().Add(person3);
            db.Save();

            db = Database.OpenDatabase("test");

            db.Table<Person>().RemoveRange((person) => { return (person.Salary >= 2); });

            db.Save();
            if (db.Tables.Count == 1 && db.Table<Person>().Count == 1)
            {
                this.RemoveRangeViaConditionLabel.Foreground = new SolidColorBrush(Colors.Green);
            }
            else
            {
                this.RemoveRangeViaConditionLabel.Foreground = new SolidColorBrush(Colors.Red);
            }
        }

then run this test,there has an error,Xml file save like this:

<?xml version="1.0" encoding="utf-16"?>
<ArrayOfPerson xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Person>
    <FirstName>John </FirstName>
    <LastName>Doe </LastName>
    <BirthDate>1900-01-01T00:00:00</BirthDate>
    <Salary>1</Salary>
  </Person>
</ArrayOfPerson><FirstName>John </FirstName>
    <LastName>Doe </LastName>
    <BirthDate>1900-01-01T00:00:00</BirthDate>
    <Salary>2</Salary>
  </Person>
  <Person>
    <FirstName>John </FirstName>
    <LastName>Doe </LastName>
    <BirthDate>1900-01-01T00:00:00</BirthDate>
    <Salary>3</Salary>
  </Person>
</ArrayOfPerson>

the Red letter is error code,please check it,thanks a lot.

Coordinator
Sep 26, 2009 at 1:12 AM

Thanks for reporting this, Jason.  I addressed the issue, updated the unit test to match the issues, created new release and posted it as recommended download.  Feel free to download and try it out.

Thanks again

--Sergey

Sep 28, 2009 at 5:39 AM

 thank you for your Reply!