protected override void SetupInheritanceSpecifics() { SuperClassDef superClassDef = new SuperClassDef(Shape.GetClassDef(), ORMapping.ClassTableInheritance); CircleNoPrimaryKey.GetClassDef().SuperClassDef = superClassDef; superClassDef.ID = ""; }
protected override void SetupInheritanceSpecifics() { Shape.GetClassDef().PropDefcol.Add(new PropDef("ShapeType_field", typeof(string), PropReadWriteRule.WriteOnce, "ShapeType_field", null)); CircleNoPrimaryKey.GetClassDef().SuperClassDef = new SuperClassDef(Shape.GetClassDef(), ORMapping.SingleTableInheritance); CircleNoPrimaryKey.GetClassDef().SuperClassDef.Discriminator = "ShapeType_field"; }
protected override void SetupInheritanceSpecifics() { CircleNoPrimaryKey.GetClassDef().SuperClassDef = new SuperClassDef(Shape.GetClassDef(), ORMapping.SingleTableInheritance); CircleNoPrimaryKey.GetClassDef().SuperClassDef.Discriminator = "ShapeType_field"; FilledCircleInheritsCircleNoPK.GetClassDef().SuperClassDef = new SuperClassDef(CircleNoPrimaryKey.GetClassDef(), ORMapping.ClassTableInheritance); }
public void TestSuperClassKey() { IBOKey msuperKey = BOPrimaryKey.GetSuperClassKey((ClassDef)CircleNoPrimaryKey.GetClassDef(), objCircle); Assert.IsTrue(msuperKey.Contains("ShapeID"), "Super class key should contain the ShapeID property"); Assert.AreEqual(1, msuperKey.Count, "Super class key should only have one prop"); Assert.AreEqual(msuperKey["ShapeID"].Value, objCircle.ID["ShapeID"].Value, "ShapeID in parent and child should be the same"); }
protected void SetupInheritanceSpecifics() { ClassDef.ClassDefs.Clear(); _classDefShape = Shape.GetClassDef(); _classDefCircleNoPrimaryKey = CircleNoPrimaryKey.GetClassDef(); _classDefCircleNoPrimaryKey.SuperClassDef = new SuperClassDef(_classDefShape, ORMapping.SingleTableInheritance); _classDefCircleNoPrimaryKey.SuperClassDef.Discriminator = "ShapeType_field"; _classDefFilledCircleNoPrimaryKey = FilledCircleNoPrimaryKey.GetClassDef(); _classDefFilledCircleNoPrimaryKey.SuperClassDef = new SuperClassDef(_classDefCircleNoPrimaryKey, ORMapping.SingleTableInheritance); _classDefFilledCircleNoPrimaryKey.SuperClassDef.Discriminator = "ShapeType_field"; }
public void TestFindAll_ClassDef_WhenIsSubType() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); CircleNoPrimaryKey.GetClassDef().SuperClassDef = new SuperClassDef(Shape.GetClassDef(), ORMapping.SingleTableInheritance); CircleNoPrimaryKey.GetClassDef().SuperClassDef.Discriminator = "ShapeType_field"; Shape.GetClassDef().PropDefcol.Add(new PropDef("ShapeType_field", typeof(string), PropReadWriteRule.WriteOnce, "ShapeType_field", null)); DataStoreInMemory dataStore = new DataStoreInMemory(); CircleNoPrimaryKey circleNoPrimaryKey = new CircleNoPrimaryKey(); dataStore.Add(circleNoPrimaryKey); //---------------Execute Test ---------------------- IBusinessObjectCollection col = dataStore.FindAll(ClassDef.Get <Shape>(), null); //---------------Test Result ----------------------- Assert.AreEqual(1, col.Count); Assert.Contains(circleNoPrimaryKey, col); Assert.IsNull(col.SelectQuery.Criteria); }
public void TestFilledCircleIsUsingCorrectInheritance() { Assert.AreEqual(ORMapping.SingleTableInheritance, CircleNoPrimaryKey.GetClassDef().SuperClassDef.ORMapping); Assert.AreEqual(ORMapping.ClassTableInheritance, FilledCircleInheritsCircleNoPK.GetClassDef().SuperClassDef.ORMapping); }
public void TestCircleIsUsingClassTableInheritance() { Assert.AreEqual(ORMapping.ClassTableInheritance, CircleNoPrimaryKey.GetClassDef().SuperClassDef.ORMapping); }