How to cache data at WPF after the application closed?
-
Hi, I have WPF app and I need to save the data(Hashtable) into the Cache for one day,also if the app was closed. I try to use ObjectCache but it cleaned in every running. May anyone have a solution, Thanks a lot.
-
Hi, I have WPF app and I need to save the data(Hashtable) into the Cache for one day,also if the app was closed. I try to use ObjectCache but it cleaned in every running. May anyone have a solution, Thanks a lot.
What Cache? If you are trying to save data, you may consider writing out as XML, or saving it to a database or serializing it to file. The choice depends on your application needs and architecture.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
What Cache? If you are trying to save data, you may consider writing out as XML, or saving it to a database or serializing it to file. The choice depends on your application needs and architecture.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
Hi, Thanks for fast reply :) . I have an Hashtable that contains objects. And I want to save it not matter what. I will glad if you can explain to me what is the better way to do it(XML or file)? Thanks again.
-
Hi, Thanks for fast reply :) . I have an Hashtable that contains objects. And I want to save it not matter what. I will glad if you can explain to me what is the better way to do it(XML or file)? Thanks again.
If the objects are all serializable, then it's a simple matter to serialize them to file using something like the
XmlSerializer
."WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
If the objects are all serializable, then it's a simple matter to serialize them to file using something like the
XmlSerializer
."WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
Hi, Thanks again. 1)Can I serialize only the Hashtable? Or I need to serialize every object one by one? 2)I have one Hashtable that its objects don't serializable, Is there any way to cache it? Thanks a lot.
-
Hi, Thanks again. 1)Can I serialize only the Hashtable? Or I need to serialize every object one by one? 2)I have one Hashtable that its objects don't serializable, Is there any way to cache it? Thanks a lot.
Serializing the hash table should serialize the component objects. Remember that they need to be serializable objects in their own right for this to work.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
Serializing the hash table should serialize the component objects. Remember that they need to be serializable objects in their own right for this to work.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
Thanks, I have linq to sql objects and I found that I can serialize the sql by putting this:
< Database ... Serialization="Unidirectional >
on the dbml file. How can I serialize Hashtable that contain objects like that? Thanks a lot.modified on Monday, August 23, 2010 2:43 AM
-
Thanks, I have linq to sql objects and I found that I can serialize the sql by putting this:
< Database ... Serialization="Unidirectional >
on the dbml file. How can I serialize Hashtable that contain objects like that? Thanks a lot.modified on Monday, August 23, 2010 2:43 AM
Why would you want to? This indicates that the data is already saved to the database - meaning you don't need to save it to a different storage medium.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
Why would you want to? This indicates that the data is already saved to the database - meaning you don't need to save it to a different storage medium.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
I have sql query and I want to save every running the row that selected from each table. I found solution for that :D. I mark the dmbl as serializable with
<Database... Serialization="Unidirectional">
and than use
NetDataContractSerializer
object to serialize\deserialize. Now, I have another problem, I want to save also the search criterions, every search I save the controls with the search criterions in hashtable, and I want to save it also at xml but the controls are not serializable(I use wpf and telerik controls). Is thare any way to do it? Thanks again.