Ejemplo n.º 1
0
        private static string GetSerializedPerson()
        {
            var xml = string.Empty;

            Person person = new Person() { Name = "testPerson", Age = 24, ID = 12345, Active = true };

            XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(person.GetType());
            using (MemoryStream memStream = new MemoryStream())
            {
                XmlTextWriter xmlWriter = new XmlTextWriter(memStream, Encoding.UTF8);
                xmlWriter.Formatting = Formatting.Indented;
                xmlWriter.Indentation = 1;
                xmlWriter.IndentChar = Convert.ToChar(9);
                ser.Serialize(xmlWriter, person);
                xmlWriter.Close();
                memStream.Close();
                xml = Encoding.UTF8.GetString(memStream.GetBuffer());
                xml = xml.Substring(xml.IndexOf(Convert.ToChar(60)));
                xml = xml.Substring(0, (xml.LastIndexOf(Convert.ToChar(62)) + 1));
            }
            return xml;
        }
Ejemplo n.º 2
0
 partial void UpdatePerson(Person instance);
Ejemplo n.º 3
0
 partial void DeletePerson(Person instance);
Ejemplo n.º 4
0
 partial void InsertPerson(Person instance);