Xamarin. Software architecture design problem programming RRS feed

  • Question

  • Hello there, 

    I've searched everywhere to try and find an answer to my question and this is my final hope. 

    We are creating an MVC website alongside a Xamarin app. So far i have written API's for the app to communicate with the website to retrieve data etc. All is good. This design issue that arises is this.

    In our data base we have a list of assets and each asset has its own properties. Some of these are the same such as

    Asset type


    Last checked

    A lot of these are unique to the asset though, for instance these assets will have their own non shared properties. 

    pull pin intact (fire extinguisher)

    battery expired (defibrillator) 

    etc etc

    The problem is, is that our client wants their users to be able to add their own assets to the database with their own fields. Or as our client base increases we will need to add more assets to go along with our hardware.

    The issue with Xamarin is that you need your view models with the properties pre-defined. Because of this, everytime we add a new type of asset to the database we will have to create a new model for Xamarin and release an update to the app store. When we release the product, we will end up spending so much time writing duplicate code and releasing app updates. I looked at code generation but IOS does not support reflection.emit.  

    My boss has come up with a very cludgy way of creating a large model with a load of empty properties. But i do not like this idea as it is a hack and i think it will blow up in our faces further down the line.

    string1     int1     datetime1

    string2     int2     datetime2

    string3     int3     datetime3


    and then mapping the database properties to this

    People in the industry must have encountered this issue before. How do you guys deal with database schemas that change and have the app update to reflect the changes without having to hard code a bunch of properties. 

    I was hoping i could get Xamarin to use the websites models or something, using API or something similar. I even thought of doing that bit in a webview, but our client wants it to have online / offline functionality.

    My plan B idea is just to have a large model with as many properties as we can think of to minimise how much we have to add further down the line. This way we would minimise releasing app updates and not deal with mapping empty temp properties, but it would still need to be maintained in the long term.

    Is this just the way it is or is there a much more elegant solution to the problem?

    Thank you for taking the time to read this



    Wednesday, February 13, 2019 10:33 AM