Example #1
0
 public override void AttachToContext(IZetboxContext ctx)
 {
     base.AttachToContext(ctx);
     if (ctx.ContainsObject(ctx.GetInterfaceType(this), this.ID) == null)
     {
         // Object is not in this Context present
         // -> Attach it. Attach will call this Method again!
         ctx.Attach(this);
     }
 }
Example #2
0
        public void ContainsObject_Not()
        {
            using (IZetboxContext ctx = GetContext())
            {
                TestObjClass obj = new TestObjClassEfImpl(null)
                {
                    ID = 10
                };
                ctx.Create <TestObjClass>();
                Assert.That(ctx.AttachedObjects.Count(), Is.EqualTo(1));

                Assert.That(ctx.ContainsObject(ctx.GetInterfaceType(obj), obj.ID), Is.Null);
            }
        }
 public override void AttachToContext(IZetboxContext ctx, Func<IFrozenContext> lazyFrozenContext)
 {
     base.AttachToContext(ctx, lazyFrozenContext);
     if (ctx.ContainsObject(ctx.GetInterfaceType(this), this.ID) == null)
     {
         // Object is not in this Context present
         // -> Attach it. Attach will call this Method again!
         ctx.Attach(this);
     }
 }