Losing blendability with mvvm light when trying to connect to sqlite in designmode

268 Views Asked by At

I was coding happily ever after a personal project, when I noticed that I lost my blendability with mvvm light framework on my view models.

Trying to figure out why, I started digging into my constructors, adding and removing and cursing in arcane languages, until I figured the next bit out:

One of my viewmodels, if in design mode, was trying to call a static class that I use to generate random data (makes it easy to test some things).

Now, one specific method was calling a Sqlite database to get a range of values, and then choosing a random one from them.

This worked great for the app in runtime, but in design time, it will just break something, and cause the blendability to disappear.

As a workaround, I'm now fetching that random value from an array of hardcoded value that resides in my "if (InDesignMode)" clause, but I'm wondering if anyone knows why this happens, and if there's a work around this.

Cheers, and thanks in advance :)

0

There are 0 best solutions below