Loading Data from Xml

Apr 28, 2011 at 11:33 AM

i work on win phone 7 app i have a problem on load data from xml file i try this project  :

http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=winphone7db&DownloadId=228163&FileTime=129472219733300000&Build=17748
but i cross a problem on class Database method LoadTable more specific on XmlSerializer 
 please if any body have an idea to resolve this problem 
Thanks.

Coordinator
Apr 29, 2011 at 1:11 AM

I am not sure exactly what you are asking.  Are you getting an error building the project?  If so, could you provide more details?

Thanks

Sergey

Apr 29, 2011 at 11:09 AM

Thanks Sergey,

I have an error on building project exactly on the following XmlSerializer constructor :  

 internal void LoadTable(IsolatedStorageFileStream tableStream, Type tableType)
        {
            string content;
            using (StreamReader reader = new StreamReader(tableStream))
            {
                content = reader.ReadToEnd();

                
                reader.Close();
            }

            using (StringReader stringReader = new StringReader(content))
            {
                Xmlserializer = new XmlSerializer(typeof(tableType));
                ITable table;
                if (!string.IsNullOrEmpty(content))
                {
                    table = (ITable)serializer.Deserialize(stringReader);
                }
                else
                {
                    table = (ITable)Activator.CreateInstance(tableType);
                }
                table.SetTableDefinition(_databaseName, _password);

                List<ITable> tables = new List<ITable>(_tables);
                var tableToRemove = (from oneTable in tables where oneTable.RowType == table.RowType select oneTable).FirstOrDefault();
                tables.Remove(tableToRemove);
                tables.Add(table);
                _tables = new ReadOnlyCollection<ITable>(tables);
                stringReader.Close();
            }

It gives that XmlSerializer not found or there is a missied assembly refrence  

I already add all the namespaces refrences that it need 

Thanks i appreciate.  


 

Coordinator
Apr 30, 2011 at 3:05 AM

All I could think is that your references are not working.  Maybe you have incorrect reference or you do not have correct version of phone tools installed?

Thanks