Custom Database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martial Artist

    #1

    Custom Database

    Dear all,

    I have kinda general question, but as long as I will need ideas that to
    implement in C#, I will dare to ask.

    I have made a custom database file format to use in my application. The data
    is saved to the file using something like this :

    FileStream fs = new FileStream( this.path, FileMode.OpenOr Create,
    FileAccess.Read Write ) ;
    byte[] header = ConstructHeader Bytes() ;
    fs.Write( header, header.Length ) ;



    And whenever the user wants to add a record to the file I do like these :

    byte[] data = ConstructRecord Bytes( myRecord ) ;
    int seekPlace = AFTERHEADER +
    fs.Seek ( fs.Length, SeekOrigin.Begi n ) ;

    So, I am able to seek and update in any place in the file. Now, after I
    finish all general stuff. I want to be able to provide a real database-like
    functionality.
    My questions are:

    1- Do you think that it is efficient to do my custom database using the File
    Streamer ( converting all objects to/from binary data )?
    2- How do you think should I implement the following: Sorting, Eliminating
    Duplicates for exisiting saved files.

    Specially For the second question I would really appreciate any suggestions.





Working...