Inserting new entries in a table:

Inserting entries differ again, in ADO you have to build a command string. In DbfDotNet you simply call the NewRecord() method and set the fields. Dbf.Net automatically uses the class you have provided to create the table. Calling the SaveChanges() is not mandatory but useful if you want your controls to refresh instantly.

Getting an individual by record ID

Getting a Individual record differs again, in ADO.Net you have to build a command string. In Dbf.Net you call a method. Also Dbf.Net automatically uses the class you have provided to create the table. Are you seeing a pattern emerging here?

Each record has a RecordHolder that store a ReadBuffer and potentially a WriteBuffer.

When the record finalize it signal the RecordHolder that the record has been finalized. This instruction is not blocking, it raises a flag that can be used in other threads.

class ClusteredFile
{
internalvirtualprotected Record InternalGetRecord(UInt32 recordNo)
{
RecordHolder holder = null;
if (!mRecordsByRecordNo.TryGetValue(recordNo, out holder)) {...}
record = holder.mRecordWeakRef.Target;
if (record==null)
{
// the object is not accessible it has finalized a while ago or is being finalized
if (holder.RecordFinalized.WaitOne())
{
//Now it has finalized we will create a new record
holder.RecordFinalized.Reset();
holder.Record = OnCreateNewRecord(/*isnew*/false, recordNo);
}
}
return holder.Record;
}
}

And then when the table thread try to get the record while it is disposing we use the method : holder.RecordFinalized.WaitOne()
to make sure the finalization has completed first.
Most of the time this method won't be blocking your DBF thread as the record has been finalized some time ago.