Click here to Skip to main content
15,885,366 members
Articles / Programming Languages / C#

Building an embedded database engine in C#

Rate me:
Please Sign up or sign in to vote.
4.91/5 (110 votes)
10 Jun 2009CPOL8 min read 317.1K   10K   347  
DbfDotNet is a very fast and compact fully managed standalone database/entity framework, for the .Net Framework.
using System;

namespace DbfDotNet
{
    public class ColumnAttribute : Attribute
    {
        string mColumnName;
        int mWidth;
        int mDecimals;
        
        OverflowBehaviour mOverflowBehaviour;
        ColumnType mColumnType;

        public ColumnAttribute()
        {
            mWidth = -1;
            mDecimals = -1;
            mColumnType = ColumnType.UNKNOWN;
        }
        
        public string ColumnName
        {
            get { return mColumnName; }
            set { mColumnName = value; }
        }
        
        /// <summary>
        /// Full width of the column (including dot and decimals).
        /// </summary>
        [System.ComponentModel.Description("Full width of the column (including dot and decimals)")] 
        public int Width
        {
            get { return mWidth; }
            set { mWidth = value; }
        }

        public int Decimals
        {
            get { return mDecimals; }
            set { mDecimals = value; }
        }

        public OverflowBehaviour OverflowBehaviour
        {
            get { return mOverflowBehaviour; }
            set { mOverflowBehaviour = value; }
        }

        public ColumnType Type
        {
            get { return mColumnType; }
            set { mColumnType = value; }
        }
   }

    public class RecordAttribute : Attribute
    {
        DbfVersion mVersion;
        FieldMapping mColumnMapping;
        OverflowBehaviour mOverflowBehaviour;
        int mWidth;

        public RecordAttribute()
        {
            mColumnMapping = FieldMapping.PrivateFields | FieldMapping.PublicFields;
            mOverflowBehaviour = OverflowBehaviour.ThrowError;
        }

        public DbfVersion Version
        {
            get { return mVersion; }
            set { mVersion = value; }
        }

        public FieldMapping FieldMapping
        {
            get { return mColumnMapping; }
            set { mColumnMapping = value; }
        }

        public OverflowBehaviour OverflowBehaviour
        {
            get { return mOverflowBehaviour; }
            set { mOverflowBehaviour = value; }
        }

        public int Width
        {
            get { return mWidth; }
            set { mWidth = Width; }
        }


    }
}

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.

License

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


Written By
Software Developer (Senior)
France France
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.

Comments and Discussions