Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- using MongoDB.Bson;
- using MongoDB.Bson.Serialization;
- using MongoDB.Driver;
- namespace ConsoleApplication2
- {
- public interface IProp
- {
- string AString { get; set; }
- }
- public class PropImpl:IProp
- {
- public string AString { get; set; }
- }
- public class SuperClass
- {
- public string Name { get; set; }
- public IProp AProp { get; set; }
- }
- class Program
- {
- private static MongoServer server = MongoServer.Create("mongodb://localhost/?safe=true");
- private static MongoDatabase db = server["InterfaceTest"];
- static void Main()
- {
- var superClass1 = new SuperClass
- {
- Name = Guid.NewGuid().ToString(),
- AProp = new PropImpl()
- };
- var superClass2 = new SuperClass
- {
- Name = Guid.NewGuid().ToString()
- };
- BsonSerializer.LookupSerializer(typeof(PropImpl));
- Debug.Print("superClass1: {0}", superClass1.ToJson());
- Debug.Print("superClass2: {0}", superClass2.ToJson());
- //var collection = db["PropA"].Insert(superClass);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement