Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

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)
United Kingdom United Kingdom
I am a French programmer.
These days I spend most of my time with the .NET framework, JavaScript and html.

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