public void MappingTest() { var provider = new AttributedMetaMappingFactory(); var map1 = provider.CreateMapping(typeof(Topic)); var map2 = provider.CreateMapping(typeof(Comment)); var topic = new Topic(); topic.Title = "Yourbunnywrote"; var field = map1.Members["title"]; Console.WriteLine(field.Accessor.GetValue(topic)); field.Accessor.SetValue(topic, "My New Title"); Console.WriteLine(map1.Table); Console.WriteLine(map2.Table); var serializer = map1.Serializer; var item = (Topic)serializer.Deserialize(new ValueDictionary(new { id = 10050, dateCreated = 129708701869781110, title = "Why Linq-to-SQL is so f*****g slow?", content = "Just because" }).ToDbValueSet()); using (Stream stream = new FileStream("/home/sergey/Projects/output.txt", FileMode.Create, FileAccess.Write)) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, item); } Console.WriteLine(item.Id); }
public void MappingTest() { var provider = new AttributedMetaMappingFactory(); var map1 = provider.CreateMapping(typeof(Topic)); var map2 = provider.CreateMapping(typeof(Comment)); var topic = new Topic(); topic.Title = "Yourbunnywrote"; var field = map1.Members["title"]; Console.WriteLine(field.Accessor.GetValue(topic)); field.Accessor.SetValue(topic, "My New Title"); Console.WriteLine(map1.Table); Console.WriteLine(map2.Table); var serializer = map1.Serializer; var item = (Topic)serializer.Deserialize(new ValueDictionary(new { id = 10050, dateCreated = 129708701869781110, title = "Why Linq-to-SQL is so f*****g slow?", content = "Just because" }).ToDbValueSet()); using (Stream stream = new FileStream("/home/sergey/Projects/output.txt", FileMode.Create, FileAccess.Write)) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, item); } Console.WriteLine(item.Id); }