This project has moved and is read-only. For the latest updates, please go here.

Convention over configuration

Dec 2, 2011 at 5:00 PM

Hi shawn, thanks for this great framework... i m wondering if you can share some thoughts if it's possible to make the implementation more easier by implementing conventions, for example imagine that i have a file deployed with my app that has all my cache settings policy settings.. like for example rules for how to make the refresh from remote source(i m imaging the URL for requests changing over time). 

Would this be possible by overriding some of your code.. or this a very different approach?!

Another scenario i think is important is pre population the cache with some data, very important if we want the app to be ready to work offline. 

thanks in advance.

Dec 7, 2011 at 12:52 AM

Hi -

Yes, I've done convention in a few places, such as the DataLoader class, for example, and I agree it works well.

For canned data, I suggest you serialize data in your application (say, in a resource) and then on first load, you take that data, create VMs, then call DataManager.Current.Save() to push them into the cache, then load as normal.

But on the convention stuff, I don't normal think of the examples above as being the way to leverage conventions.  

For the URL locations, I think this might be a special case where you want to be able to easily switch your app from pointing to a public or staging/test server, but that's definitely more of a configuration thing that's pretty straight forward to implement in code.

Maybe you can give me some more scenarios?  I'm open to doing it if it's truely something that a wide variety of apps would need.



Dec 7, 2011 at 1:34 AM
Edited Dec 7, 2011 at 1:36 AM

Hi shawn and thank you for your response.

i understand your recommendation for canned data..  i will try that tomorrow to see how it works.

about the conventions i was thinking in most applications that are just a panorama/pivot with data from the cloud. I see this kind of apps all the time and they are pretty similar, they also have a core that is content, showing the app with nothing event for the first time (like selling it to a client) you normally want some data in there, or maybe just for easier debug and development.  This apps also work similar, they request that data content from a url, normally a base url, following by particular requests to some endoints or querys. So i was trying to talk in some kind of system that could get this keys(endpoins) and use the common webloadrequest on the dataloader to fetch from the base url, construct the url by some kind of convencion ,so i could set up my cache by just pointing to a file that has the keys(endpoints, base url, and the policy for that VM, and going further.. it maybe it not even necessary to point it can look in our app for them using the same convencion. 

but maybe this is just my particular scenario and should be a implementation of the framework and not in the bits. 

My all ideia is that caching data and working offline is big issue in mobile world, and also this can be easily work with silverlight, wpf,  winrt.. and so on... and since i don't see good  helpers and pointers to make the development in windows phne easier in this field i think there's even more scenarios out there. 

I wish Microsoft could get more time project :)