public void WhereDynamicReference() { using (SoodaTransaction tran = new SoodaTransaction()) { AddReferenceField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; o[ReferenceField] = Contact.Mary; IEnumerable <PKInt32> pe = PKInt32.Linq().Where(p => ((Contact)p[ReferenceField]).LastSalary.Value == 42); CollectionAssert.IsEmpty(pe); pe = PKInt32.Linq().Where(p => ((Contact)p[ReferenceField]).LastSalary.Value == 123.123456789M); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pe); pe = PKInt32.Linq().Where(p => ((Contact)p[ReferenceField]).GetLabel(false) == "Mary Manager"); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pe); } finally { o.MarkForDelete(); Remove(ReferenceField, tran); } } }
public void SelectDynamic() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); try { PKInt32.GetRef(7777778)[IntField] = 42; IEnumerable <object> oe = PKInt32.Linq().Select(p => p[IntField]); CollectionAssert.AreEquivalent(new object[] { null, 42, null }, oe); } finally { Remove(IntField, tran); } } }
public void WhereDynamicUpdate() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); try { PKInt32.GetRef(7777777)[IntField] = 42; IEnumerable <PKInt32> pe = PKInt32.Linq().Where(p => (int)p[IntField] == 5); CollectionAssert.IsEmpty(pe); pe = PKInt32.Linq().Where(p => (int)p[IntField] == 42); CollectionAssert.AreEquivalent(new PKInt32[] { PKInt32.GetRef(7777777) }, pe); } finally { Remove(IntField, tran); } } }
public void WhereDynamicInsert() { using (SoodaTransaction tran = new SoodaTransaction()) { AddIntField(tran); PKInt32 o = new PKInt32(); try { o.Parent = o; o[IntField] = 42; IEnumerable <PKInt32> pe = PKInt32.Linq().Where(p => (int)p[IntField] == 5); CollectionAssert.IsEmpty(pe); pe = PKInt32.Linq().Where(p => (int)p[IntField] == 42); CollectionAssert.AreEquivalent(new PKInt32[] { o }, pe); } finally { o.MarkForDelete(); Remove(IntField, tran); } } }