Part 22 - Storing and Retrieving Serialized Data

Sign in to queue

The Discussion

  • User profile image
    Daniel

    Isn't there a way to use a relational database to persist data on WP8.1 apps instead of json files? To be honest, it doesn't even need to be relational, just an easier way to make "intelligent queries" to the application data instead of having to manually sweep through all of the stored data... I couldn't find it anywhere on the Windows Runtime Reference.

    Thanks in advance, and a big thanks for the great tutorial. Your series of tutorials is by far the best way to start as a WP developer that I know of.

  • User profile image
    Karan

    I tried following the code in VS2013. When I click on Write after copying the code snippets for Data Contract, the app crashes with :
    "A first chance exception of type 'System.Runtime.Serialization.InvalidDataContractException' occurred in SYSTEM.RUNTIME.SERIALIZATION.NI.DLL
    A first chance exception of type 'System.Runtime.Serialization.InvalidDataContractException' occurred in mscorlib.ni.dll
    A first chance exception of type 'System.Runtime.Serialization.InvalidDataContractException' occurred in mscorlib.ni.dll"

    Not sure why this is.
    Thanks for your amazing tutorials.

  • User profile image
    Karan

    Following this http://stackoverflow.com/questions/8294187/i-dont-know-why-my-class-cannot-be-serialized helped fix the problem, but should it need to be included?

  • User profile image
    ryanthtra

    @Karan: I had this problem, too.  I think that, if you followed his directions on the video for making the Car class and then typed in the properties yourself using Snippets ("prop", Tab, Tab), you may have forgotten to add the "public" access modifier for class Car.  Once I added "public" before "class Car", I had no more problems.  You don't need to use attributes in this case.

  • User profile image
    Starfall

    Thank you @ryanthtra, it worked perfectly! I had the same error as @Karan, but the "public" before the class Car fixed it! ;)

  • User profile image
    HughD

    Thanks @ryanthtra, I had same problem as @Karan but now working fine with public

  • User profile image
    Daniel

    Hello
    I am a beginner and have a question.
    How can I save the contents of a variable (the text, because there text show my html page inside. You would like to call later). As html file. To use as source for webview.

    Many Thanks

Add Your 2 Cents