I have a project that has a DD design, and also uses dependency injection. During development, we connect to a test database which contains a former snapshot of production. This works well 95% of the time. However, for some processes that we have to implement into our application, the underlying SQL statements, (of which I can't control and are developed by a third party) are slow. Some of these procedures can take 30 seconds while even others might take over 5 minutes to execute.
Our UI's rely on this data and, unfortunately, our users understand that there are some tasks they have to start and just wait for the data to arrive. For now, I'm not asking for ways to speed up the final application. Simply put, there are just to many factors outside of our control and this limitation has to be accepted as part of the final result.
However, while developing the UI I do require a responsive return of results from my domain. To do this, I've setup fake repositories within my application project. Specifically, I have an ASP.Net project that initializes all of the DI components within the
AppHost. It is hear that all repos are injected into the container, followed by the respective domains, which are then used by the ASP.Net APIs that are utilized by the web page UI.
So far, what I've done has been to create fake repositories from within ASP.Net project. Within the
AppHost, I have an
#ifdef FAKES preprocessor that checks to see if I've specified that I'd like to use the fake repos, and it then loads the fakes, rather than the legit ones which are used during normal testing and eventually production.
This work but feels... wrong. Maybe this is the correct approach, but I feel as if there has to be a better way of injecting fake data repos into my application for development. Is there a better appraoch for this purpose?
One requirement is that I do not want to always access this faked data in development. While building UIs, I often could care less about what the data looks like, so long as something is there that has the right data types and string lengths. However, once it's time to test implementation, I will always have to wait for the legitimate test data to load from our test servers.
Just to be clear, these fakes are not for unit testing. In this context, I am strictly creating fake repositories so that I'm getting data back in milliseconds, rather than 2-3 minutes. Is there a better way of implementing and loading these context-specific development fakes?