Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Linq;
- using System.Threading;
- using MongoDB.Bson.Serialization.Attributes;
- using MongoDB.Driver;
- using MongoDB.Driver.Builders;
- using MongoDB.Driver.Linq;
- using NUnit.Framework;
- using System.Collections.Generic;
- using System;
- using MongoDB.Bson;
- using MongoDB.Bson.Serialization;
- using System.Linq.Expressions;
- namespace ThreadFail
- {
- public static class Program
- {
- public interface IFoo
- {
- string Description { get; set; }
- }
- [Serializable]
- public class Foo : IFoo
- {
- public string Description { get; set; }
- }
- [Serializable]
- public class Bar
- {
- public ObjectId Id { get; set; }
- public IFoo MyFoo { get; set; }
- }
- public static void Main()
- {
- var server = MongoServer.Create();
- var database = server.GetDatabase("test");
- var collection = database.GetCollection<Bar>("bars");
- collection.RemoveAll();
- var bar = new Bar
- {
- MyFoo = new Foo { Description = "test" }
- };
- collection.Insert(bar);
- bar = collection.FindOne();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement