Adding database layer

Hey guys,

I have a question about database access layer

I want to rewrite current database “layer” since every piece of code logic from connecting, initializing and CRUD operation in a single file and it’s a pain to find anything and as the project grows it will add more pain and suffering :smile:

Any suggestion how can I create this layer and have access to the database trough all my project and splitting so I can manage my source code

Currently my options

  • Using partial (introduce small complexity and bit confusion when accessing)
  • Repository pattern/Unity of Work (I think dependency injection is not a common thing in game creating)
  • Creating .dll (?)
  • Creating an API that Unity interacts with (adding extra latency since it need get the data trough the API)

Since it’s an online rpg game it has high INSERT/UPDATE operation

Any suggestion would be appreciate.

You are aware, that your DB should he on the server side?
Such DBases are capable, to cache data in memory, for frequent read / write.

hey Antypdish,

Yeah, the interaction with the database is on the server side Client only send packets