Click here to Skip to main content
11,927,600 members (46,572 online)
Click here to Skip to main content


337 bookmarked

Building an embedded database engine in C#

, 10 Jun 2009 CPOL
DbfDotNet is a very fast and compact fully managed standalone database/entity framework, for the .Net Framework.
using System;
using System.Collections.Generic;
using System.Text;

namespace DbfDotNet.Core
    [Record(FieldMapping = FieldMapping.ExplicitColumnsOnly)]
    internal class NdxEntry 
        [Column(Type = ColumnType.UINT32)]
        internal UInt32 mNdxNativeLowerPageNo;

        [Column(Type = ColumnType.UINT32)]
        public UInt32 DbfRecordNo;

        private SortFields mFields;
        public SortFields Fields
            get { return mFields; }
            set { 
                if (mFields==value) return;
                mFields = value;

        public UInt32 LowerPageRecordNo
            get { return mNdxNativeLowerPageNo - 1; }
            set { mNdxNativeLowerPageNo = value + 1; }

        public int ChainCompare(int[] cmp, NdxFile index, NdxEntry other)
            this.Fields.ChainCompare(other.Fields, cmp);
            // to do check for ascending descending
            for (int i = 0; i < cmp.Length; i++)
                if (cmp[i] != 0) return cmp[i];
            // if we're here the fields are identical
            // we compare RecordNo when the index is NOT unique
            if (index.mNdxHeader.UniqueFlag) return 0;
            else return DbfRecordNo.CompareTo(other.DbfRecordNo);

        public override string ToString()
            return Fields.ToString() + " " + DbfRecordNo.ToString();

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Pascal Ganaye
Software Developer (Senior)
United Kingdom United Kingdom
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151126.1 | Last Updated 10 Jun 2009
Article Copyright 2009 by Pascal Ganaye
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid