Search Unity

DB Queries to JSON files

Discussion in 'Scripting' started by tvle83, May 10, 2012.

  1. tvle83

    tvle83

    Joined:
    Apr 16, 2011
    Posts:
    15
    I am working on a project that has a lot of information in a fairly robust relational database. A lot of this information is static information, but will be required during gameplay.

    A lot of the querying is easy to do because of LINQ function calls compiled into a DLL. What I am thinking about doing is using those LINQ functions and building a JSON file with all the required information about the objects (there are 300 or so) so that they are local and it will reduce db queries for this information.

    This script could be part of the startup of the game that will check a time stamp or something to make sure it is up to date and will update the information if it is more than 24-48 hours old or something.

    My question is, is this a good idea because it is static information or is there a better way to do it or should I just leave it to the LINQ functions because there will be hardly any improvement?

    Thank you
     
    Last edited: May 12, 2012
  2. tvle83

    tvle83

    Joined:
    Apr 16, 2011
    Posts:
    15
    Bump, please give me some advice =)
     
  3. tvle83

    tvle83

    Joined:
    Apr 16, 2011
    Posts:
    15
    Nothing, no opinions? =\ I am going through with it after all and am almost done with it but still would like an opinion about this.
     
  4. MadRobot

    MadRobot

    Joined:
    Jul 12, 2011
    Posts:
    339
    It's not really clear what you are asking
     
  5. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    You will have to write a conversion table that converts the db result to a JSON (or javascript object) block. It is rather simple in the end run.

    No clue why you want to go back and forth with JSON, unless you are actually talking to a JavaScript processor like a web page.

    I would write it both ways, one to convert it from and to JSON.