Verify Feature with Serialize Enrollment

  • Yorimitsu

    Hi Robert, let me start by saying I love the work done on SourceAFIS.

    I'm just looking through the sample code given and I noticed it uses the serialized method to enroll users in the database. Since the person is enrolled into the database without a specific 'Person' parameter how could we go about referencing them in the verify feature.

    ie. if we use:
    Person person1 = new Person(fp1, fp2);
    Person person2 = new Person(fp1, fp2);

    we can simply use:
    afis.Verify(person1, person2)

    But we don't have the 'person1' or 'person2' etc names to use when using serialization. How do we extract the users from the database in this method?


  • Robert Važan
    Robert Važan

    Hi Yorimitsu,

    serialization options have been already extensively discussed:

    I am not sure which sample you are referring to. The latest C# sample uses serialization like this:

    BinaryFormatter formatter = new BinaryFormatter();
    Console.WriteLine("Saving database...");
    using (Stream stream = File.Open("database.dat", FileMode.Create))
        formatter.Serialize(stream, database);
    Console.WriteLine("Reloading database...");
    using (FileStream stream = File.OpenRead("database.dat"))
        database = (List<MyPerson>)formatter.Deserialize(stream);

    This way the name of the person is preserved in MyPerson.Name field.

    Kind Regards,