A
Andrus
I have subclassed entity object used to store settigns per every MDI form:
class MyApp.EntityBase.Kontekst {
public string mybaseprop1 { get { ... } set { ... } }
....
}
class MyApp.EntityExtension.Kontekst: MyApp.EntityBase.Kontekst{
public string property1 { get { ... } set { ... } }
....
}
class MyApp.Business.Kontekst: MyApp.EntityExtension.Kontekst {
public string method1 { ... }
....
}
I need to save / restore it in user computer. I tried to use the following
method to save
public static void Save(object obj, string id) {
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForAssembly();
XmlSerializer formatter = new XmlSerializer(obj.GetType(), "mynsp");
.....
but last line causes runtime error
There was an error reflecting type 'Kontekst'.
Types MyApp.EntityExtension.Kontekst' and 'Kontekst' both
use the XML type name, 'Kontekst', from namespace 'mynsp'. Use XML
attributes to specify a unique XML name and/or namespace for the type."
How to fix this ? Kontext classes are Linq classes generated automatically.
Is it possible to use some other form of saving or serialization or should I
add xml
attributes manually ?
Andrus.
..NET 3.5 WinForms.
class MyApp.EntityBase.Kontekst {
public string mybaseprop1 { get { ... } set { ... } }
....
}
class MyApp.EntityExtension.Kontekst: MyApp.EntityBase.Kontekst{
public string property1 { get { ... } set { ... } }
....
}
class MyApp.Business.Kontekst: MyApp.EntityExtension.Kontekst {
public string method1 { ... }
....
}
I need to save / restore it in user computer. I tried to use the following
method to save
public static void Save(object obj, string id) {
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForAssembly();
XmlSerializer formatter = new XmlSerializer(obj.GetType(), "mynsp");
.....
but last line causes runtime error
There was an error reflecting type 'Kontekst'.
Types MyApp.EntityExtension.Kontekst' and 'Kontekst' both
use the XML type name, 'Kontekst', from namespace 'mynsp'. Use XML
attributes to specify a unique XML name and/or namespace for the type."
How to fix this ? Kontext classes are Linq classes generated automatically.
Is it possible to use some other form of saving or serialization or should I
add xml
attributes manually ?
Andrus.
..NET 3.5 WinForms.