Click here to Skip to main content
15,886,873 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 318.2K   10K   347  
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
{

    //internal interface IDbfValue<T>
    //    where T : IComparable<T>
    //{
    //    bool OriginalIsNull { get; set; }
    //    T OriginalValue { get; set; }
    //    bool IsNull { get; set; }
    //    T Value { get; set; }
    //}

    //public struct DbfField<T> : IDbfValue<T> 
    //    where T : struct, IComparable<T>
    //{
    //    private bool mIsNull;
    //    internal T mValue;

    //    private bool mOriginalIsNull;
    //    internal T mOriginalValue;

    //    public DbfField(T value)
    //    {
    //        mOriginalIsNull = true;
    //        this.mOriginalValue = default(T);

    //        mIsNull = false;
    //        this.mValue = value;
    //    }

    //    public T Value
    //    {
    //        get
    //        {
    //            if (this.mIsNull)
    //            {
    //                throw new Exception("No value available.");
    //            }
    //            return this.mValue;
    //        }
    //        set
    //        {
    //            mValue = value;
    //            mIsNull = false;
    //        }
    //    }

    //    public override bool Equals(object other)
    //    {
    //        if (this.mIsNull)
    //        {
    //            return (other == null);
    //        }
    //        if (other == null)
    //        {
    //            return false;
    //        }
    //        return this.mValue.Equals(other);
    //    }
                
    //    public static implicit operator DbfField<T>(T value)
    //    {
    //        return new DbfField<T>(value);
    //    }

    //    public static explicit operator T(DbfField<T> value)
    //    {
    //        return value.Value;
    //    }

    //    #region IDbfValue<T> Members


    //    public T OriginalValue
    //    {
    //        get { return mOriginalValue; }
    //        set { mOriginalValue = value; }
    //    }

    //    #endregion
    //}

    //public struct DbfString : IDbfValue<string>
    //{
    //    internal string mValue;
    //    internal string mOriginalValue;

    //    public DbfString(string value)
    //    {
    //        this.mOriginalValue = null;
    //        this.mValue = value;
    //    }

    //    #region IDbfValue<string> Members

    //    bool IDbfValue<string>.OriginalIsNull
    //    {
    //        get
    //        {
    //            throw new NotImplementedException();
    //        }
    //        set
    //        {
    //            throw new NotImplementedException();
    //        }
    //    }

    //    string IDbfValue<string>.OriginalValue
    //    {
    //        get
    //        {
    //            return mOriginalValue;
    //        }
    //        set
    //        {
    //            mOriginalValue = value;
    //        }
    //    }

    //    public bool IsNull // implements IDbfValue<string>.IsNull
    //    {
    //        get
    //        {
    //            throw new NotImplementedException();
    //        }
    //        set
    //        {
    //            throw new NotImplementedException();
    //        }
    //    }

    //    public string Value // implements IDbfValue<string>.Value
    //    {
    //        get
    //        {
    //            throw new NotImplementedException();
    //        }
    //        set
    //        {

    //            throw new NotImplementedException();
    //        }
    //    }


    //    #endregion
    //}


 

    //public struct DbfInt32 : IDbfValue<Int32>
    //{
    //    #region IDbfValue<int> Members

    //    int IDbfValue<int>.Value
    //    {
    //        get
    //        {
    //            throw new NotImplementedException();
    //        }
    //        set
    //        {
    //            throw new NotImplementedException();
    //        }
    //    }

    //    int IDbfValue<int>.OriginalValue
    //    {
    //        get
    //        {
    //            throw new NotImplementedException();
    //        }
    //        set
    //        {
    //            throw new NotImplementedException();
    //        }
    //    }

    //    bool IDbfValue<int>.IsNull
    //    {
    //        get
    //        {
    //            throw new NotImplementedException();
    //        }
    //        set
    //        {
    //            throw new NotImplementedException();
    //        }
    //    }

    //    bool IDbfValue<int>.OriginalIsNull
    //    {
    //        get
    //        {
    //            throw new NotImplementedException();
    //        }
    //        set
    //        {
    //            throw new NotImplementedException();
    //        }
    //    }

    //    #endregion
    //}
}

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