Click here to Skip to main content
12,999,157 members (44,219 online)
Click here to Skip to main content

Stats

204.6K views
8.3K downloads
338 bookmarked
Posted 1 Jun 2009

Building an embedded database engine in C#

, 10 Jun 2009
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)

Share

About the Author

Pascal Ganaye
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.

You may also be interested in...

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