Beispiel #1
0
        static void Main(string[] args)
        {
            var ctx  = new MongoContext("mongodb://localhost:27017/searchathing_patterns_mongoscopedchildren");
            var repo = ctx.GetRepository <BaseDoc>();

            {
                var filter = Builders <BaseDoc> .Filter.Empty;
                repo.Collection.DeleteMany(filter);
            }

            {
                var A = new BaseDoc();
                A.Child = new ChildClass(A);
                repo.GenericInsert(ctx, A);
            }

            {
                var A = repo.Collection.AsQueryable().First();
                A.Child.DoSomeJob();
            }
        }
Beispiel #2
0
 /// <summary>
 /// In this child SetScope will called from the ISupportInitialize root at EndInit().
 /// </summary>
 public void SetScope(object root)
 {
     BaseDoc = root as BaseDoc;
 }
Beispiel #3
0
 /// <summary>
 /// Constructor for run-time object allocation.
 /// </summary>
 public ChildClass(BaseDoc _BaseDoc)
 {
     BaseDoc = _BaseDoc;
 }