public static ClassDef CreateTestMapperClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("ShapeName", typeof(String), PropReadWriteRule.ReadWrite, "ShapeName", null); lPropDefCol.Add(propDef); propDef = new PropDef("ShapeID", typeof(Guid), PropReadWriteRule.WriteOnce, "ShapeID_field", null); lPropDefCol.Add(propDef); propDef = new PropDef("ShapeValue", typeof(Int32), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); // propDef = new PropDef("MyID", typeof(Guid), PropReadWriteRule.WriteOnce, null); // lPropDefCol.Add(propDef); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["ShapeID"]); KeyDefCol keysCol = new KeyDefCol(); KeyDef lKeyDef = new KeyDef(); lKeyDef.Add(lPropDefCol["ShapeName"]); keysCol.Add(lKeyDef); // RelKeyDef relKeyDef = new RelKeyDef(); //RelPropDef lRelPropDef = new RelPropDef(propDef, "OwnerID"); //relKeyDef.Add(lRelPropDef); //RelationshipDef relDef = new MultipleRelationshipDef("Owner", typeof (Shape), // relKeyDef, false, "", DeleteParentAction.DereferenceRelated); RelationshipDefCol relDefCol = new RelationshipDefCol(); //relDefCol.Add(relDef); ClassDef lClassDef = new ClassDef(typeof(Shape), primaryKey, "Shape_table", lPropDefCol, keysCol, relDefCol); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
protected static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Surname", typeof(String), PropReadWriteRule.ReadWrite, null); propDef.AddPropRule(new PropRuleString("ContactPerson-" + propDef.PropertyName, "", 2, 50, null)); lPropDefCol.Add(propDef); propDef = new PropDef("FirstName", typeof(String), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("DateOfBirth", typeof(DateTime), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); //Create concurrency control properties propDef = new PropDef("DateLastUpdated", typeof(DateTime), PropReadWriteRule.ReadWrite, DateTime.Now); lPropDefCol.Add(propDef); propDef = new PropDef("UserLastUpdated", typeof(string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("MachineLastUpdated", typeof(string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("VersionNumber", typeof(int), PropReadWriteRule.ReadWrite, 1); lPropDefCol.Add(propDef); propDef = new PropDef(PK1_PROP1_NAME, typeof(string), PropReadWriteRule.ReadWrite, "PK1_Prop1", null); lPropDefCol.Add(propDef); propDef = new PropDef(PK1_PROP2_NAME, typeof(string), PropReadWriteRule.ReadWrite, "PK1_Prop2", null); lPropDefCol.Add(propDef); return(lPropDefCol); }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef ("MockBOProp1", typeof(Guid), PropReadWriteRule.ReadWrite, "MockBOProp1", null, true, false); lPropDefCol.Add(propDef); lPropDefCol.Add("MockBOProp2", typeof(string), PropReadWriteRule.WriteOnce, "MockBOProp2", null); lPropDefCol.Add("MockBOID", typeof(Guid), PropReadWriteRule.WriteOnce, "MockBOID", null); return(lPropDefCol); }
protected static PropDefCol CreateBOPropDef() { var lPropDefCol = new PropDefCol(); var propDef = new PropDef(PK1_PROP1_NAME, typeof(string), PropReadWriteRule.ReadWrite, "PK1_Prop1", null); lPropDefCol.Add(propDef); propDef = new PropDef(PK1_PROP2_NAME, typeof(string), PropReadWriteRule.ReadWrite, "PK1_Prop2", null); lPropDefCol.Add(propDef); return(lPropDefCol); }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); IPropDef propDef = new PropDef("EngineNo", typeof(String), PropReadWriteRule.ReadWrite, "ENGINE_NO", null); lPropDefCol.Add(propDef); propDef = lPropDefCol.Add("EngineID", typeof(Guid), PropReadWriteRule.WriteOnce, "Engine_ID", null); propDef = lPropDefCol.Add("CarID", typeof(Guid), PropReadWriteRule.ReadWrite, "CAR_ID", null); return(lPropDefCol); }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("TransactionSequenceNo", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("DateTimeUpdated", typeof(DateTime), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("WindowsUser", typeof(String), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); propDef = new PropDef("LogonUser", typeof(String), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("BusinessObjectTypeName", typeof(string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("CRUDAction", typeof(string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("DirtyXML", typeof(string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("MachineName", typeof(string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); return(lPropDefCol); }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("CarRegNo", typeof(String), PropReadWriteRule.ReadWrite, "CAR_REG_NO", null); lPropDefCol.Add(propDef); lPropDefCol.Add("OwnerId", typeof(Guid), PropReadWriteRule.ReadWrite, "OWNER_ID", null); lPropDefCol.Add("CarID", typeof(Guid), PropReadWriteRule.WriteOnce, "CAR_ID", null); lPropDefCol.Add("DriverFK1", typeof(String), PropReadWriteRule.WriteOnce, "Driver_FK1", null); lPropDefCol.Add("DriverFK2", typeof(String), PropReadWriteRule.WriteOnce, "Driver_FK2", null); return(lPropDefCol); }
private new static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Radius", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); //propDef = new PropDef("ContactPersonID", typeof(Guid), PropReadWriteRule.WriteOnce, "ContactPersonID", null); //lPropDefCol.Add(propDef); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); //RelKeyDef relKeyDef = new RelKeyDef(); //IPropDef relPropDef = lPropDefCol["ContactPersonID"]; //RelPropDef lRelPropDef = new RelPropDef(relPropDef, "ContactPersonID"); //relKeyDef.Add(lRelPropDef); //RelationshipDef relDef = new SingleRelationshipDef("ContactPerson", typeof(ContactPerson), relKeyDef, false, DeleteParentAction.DoNothing); //relDefCol.Add(relDef); ClassDef lClassDef = new ClassDef(typeof(CircleNoPrimaryKey), null, "circle_table", lPropDefCol, keysCol, relDefCol, null); //ClassDef lClassDef = new ClassDef(typeof(CircleNoPrimaryKey), null, lPropDefCol, keysCol, relDefCol); lClassDef.SuperClassDef = new SuperClassDef(Shape.GetClassDef(), ORMapping.ClassTableInheritance); ClassDef.ClassDefs.Add(lClassDef); return(lClassDef); }
private new static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Radius", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); //propDef = new PropDef("ContactPersonID", typeof(Guid), PropReadWriteRule.WriteOnce, "ContactPersonID", null); //lPropDefCol.Add(propDef); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); //RelKeyDef relKeyDef = new RelKeyDef(); //IPropDef relPropDef = lPropDefCol["ContactPersonID"]; //RelPropDef lRelPropDef = new RelPropDef(relPropDef, "ContactPersonID"); //relKeyDef.Add(lRelPropDef); //RelationshipDef relDef = new SingleRelationshipDef("ContactPerson", typeof(ContactPerson), relKeyDef, false, DeleteParentAction.DoNothing); //relDefCol.Add(relDef); ClassDef lClassDef = new ClassDef(typeof(CircleNoPrimaryKey), null, "circle_table", lPropDefCol, keysCol, relDefCol, null); //ClassDef lClassDef = new ClassDef(typeof(CircleNoPrimaryKey), null, lPropDefCol, keysCol, relDefCol); lClassDef.SuperClassDef = new SuperClassDef(Shape.GetClassDef(), ORMapping.ClassTableInheritance); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
public void init() { PropDef propDef = new PropDef("Prop", typeof(string), PropReadWriteRule.ReadWrite, null); _relPropDef = new RelPropDef(propDef, "PropName"); _propDefCol = new PropDefCol(); _propDefCol.Add(propDef); }
private new static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); IPropDef propDef = new PropDef("Colour", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = lPropDefCol.Add("FilledCircleID", typeof(Guid), PropReadWriteRule.WriteOnce, "FilledCircleID_field", null); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["FilledCircleID"]); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); ClassDef lClassDef = new ClassDef(typeof (FilledCircle), primaryKey, "FilledCircle_table", lPropDefCol, keysCol, relDefCol); lClassDef.SuperClassDef = new SuperClassDef(Circle.GetClassDef(), ORMapping.ConcreteTableInheritance); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
public void SetUp() { PropDef propDef = new PropDef("Prop", typeof(string), PropReadWriteRule.ReadWrite, null); mRelPropDef = new RelPropDef(propDef, "PropName"); mPropDefCol = new PropDefCol(); mPropDefCol.Add(propDef); BORegistry.DataAccessor = new DataAccessorInMemory(); }
public void init() { PropDef propDef = new PropDef("Prop", typeof(string), PropReadWriteRule.ReadWrite, null); _relPropDef = new RelPropDef(propDef, "PropName"); _propDefCol = new PropDefCol(); _propDefCol.Add(propDef); }
public void Setup() { ClassDef.ClassDefs.Clear(); mRelKeyDef = new RelKeyDef(); mPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Prop", typeof(string), PropReadWriteRule.ReadWrite, "1"); mPropDefCol.Add(propDef); RelPropDef lRelPropDef = new RelPropDef(propDef, "PropName"); mRelKeyDef.Add(lRelPropDef); propDef = new PropDef("Prop2", typeof(string), PropReadWriteRule.ReadWrite, "2"); mPropDefCol.Add(propDef); lRelPropDef = new RelPropDef(propDef, "PropName2"); mRelKeyDef.Add(lRelPropDef); }
//public ClassDefBuilder AddPropDef(string propertyName) //{ // PropDef propDef = new PropDefBuilder().WithPropertyName(propertyName); // if (_propDefCol == null) _propDefCol = new PropDefCol(); // _propDefCol.Add(propDef); // return this; //} public ClassDefBuilder AddPropDef(PropDef propDef) { if (_propDefCol == null) { _propDefCol = new PropDefCol(); } _propDefCol.Add(propDef); return(this); }
public void SetUp() { PropDef propDef = new PropDef("Prop", typeof(string), PropReadWriteRule.ReadWrite, null); mRelPropDef = new RelPropDef(propDef, "PropName"); mPropDefCol = new PropDefCol(); mPropDefCol.Add(propDef); BORegistry.DataAccessor = new DataAccessorInMemory(); }
protected static PropDefCol CreateBOPropDef() { var lPropDefCol = new PropDefCol(); var propDef = new PropDef(PK1_PROP1_NAME, typeof(string), PropReadWriteRule.ReadWrite, "PK1_Prop1", null); lPropDefCol.Add(propDef); return lPropDefCol; }
public void Setup() { ClassDef.ClassDefs.Clear(); mRelKeyDef = new RelKeyDef(); mPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Prop", typeof(string), PropReadWriteRule.ReadWrite, "1"); mPropDefCol.Add(propDef); RelPropDef lRelPropDef = new RelPropDef(propDef, "PropName"); mRelKeyDef.Add(lRelPropDef); propDef = new PropDef("Prop2", typeof(string), PropReadWriteRule.ReadWrite, "2"); mPropDefCol.Add(propDef); lRelPropDef = new RelPropDef(propDef, "PropName2"); mRelKeyDef.Add(lRelPropDef); }
public void TestEquals() { PropDefCol propDefCol1 = new PropDefCol(); PropDef def = new PropDef("bob", typeof(string), PropReadWriteRule.ReadOnly, null); propDefCol1.Add(def); PropDefCol propDefCol2 = new PropDefCol(); propDefCol2.Add(def); Assert.AreEqual(propDefCol1, propDefCol2); }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("SomeNewProp", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); ClassDef lClassDef = new ClassDef(typeof(BOWithIntID_Child), null, "bowithintid", lPropDefCol, keysCol, relDefCol, null); return lClassDef; }
private new static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); IPropDef propDef = new PropDef("Colour", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = lPropDefCol.Add("FilledCircleID", typeof(Guid), PropReadWriteRule.WriteOnce, "FilledCircleID_field", null); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["FilledCircleID"]); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); ClassDef lClassDef = new ClassDef(typeof(FilledCircle), primaryKey, "FilledCircle_table", lPropDefCol, keysCol, relDefCol); lClassDef.SuperClassDef = new SuperClassDef(Circle.GetClassDef(), ORMapping.ConcreteTableInheritance); ClassDef.ClassDefs.Add(lClassDef); return(lClassDef); }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("SomeNewProp", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); ClassDef lClassDef = new ClassDef(typeof(BOWithIntID_Child), null, "bowithintid", lPropDefCol, keysCol, relDefCol, null); return(lClassDef); }
private static ClassDef CreateTestClassDef(string suffix) { PropDefCol propDefCol = new PropDefCol(); PropDef propDef = new PropDef("TestProperty" + suffix, typeof(string), PropReadWriteRule.ReadWrite, null, null, false, false, 100, "Tested Property" + suffix, "This is a property for testing."); propDefCol.Add(propDef); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef { propDef }; return(new ClassDef("TestAssembly", "TestClass" + suffix, primaryKeyDef, propDefCol, new KeyDefCol(), new RelationshipDefCol(), new UIDefCol())); }
private new static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Colour", typeof(int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); //ClassDef lClassDef = new ClassDef(typeof (FilledCircleNoPrimaryKey), null, lPropDefCol, keysCol, relDefCol); ClassDef lClassDef = new ClassDef(typeof(FilledCircleNoPrimaryKey), null, "FilledCircle_table", lPropDefCol, keysCol, relDefCol, null); lClassDef.SuperClassDef = new SuperClassDef(Circle.GetClassDef(), ORMapping.ConcreteTableInheritance); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
public void Test_Add_ShouldSetPropDefsClassDef() { //---------------Set up test pack------------------- PropDef propDef = new PropDefFake(); PropDefCol col = new PropDefCol(); var expectedClassDef = MockRepository.GenerateStub<IClassDef>(); col.ClassDef = expectedClassDef; //---------------Assert Preconditions--------------- Assert.IsNull(propDef.ClassDef); //---------------Execute Test ---------------------- col.Add(propDef); //---------------Test Result ----------------------- Assert.AreSame(expectedClassDef, propDef.ClassDef); }
private static PropDefCol CreateBOPropDef() { PropDefCol propDefCol = new PropDefCol(); propDefCol.Add("AddressID", typeof(Guid), PropReadWriteRule.WriteOnce, null); propDefCol.Add("ContactPersonID", typeof(Guid), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine1", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine2", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine3", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine4", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("OrganisationID", typeof(Guid), PropReadWriteRule.ReadWrite, null); return(propDefCol); }
public void TestCreateRelPropNotNull() { PropDef propDef = new PropDef("Prop1", typeof(string), PropReadWriteRule.ReadWrite, "1"); RelPropDef relPropDef = new RelPropDef(propDef, "PropName1"); PropDefCol propDefCol = new PropDefCol(); propDefCol.Add(propDef); IBOPropCol propCol = propDefCol.CreateBOPropertyCol(true); IRelProp relProp = relPropDef.CreateRelProp(propCol); Assert.AreEqual(relPropDef.OwnerPropertyName, relProp.OwnerPropertyName); Assert.AreEqual(relPropDef.RelatedClassPropName, relProp.RelatedClassPropName); Assert.IsFalse(relProp.IsNull); }
public void TestCreateRelPropNotNull() { PropDef propDef = new PropDef("Prop1", typeof(string), PropReadWriteRule.ReadWrite, "1"); RelPropDef relPropDef = new RelPropDef(propDef, "PropName1"); PropDefCol propDefCol = new PropDefCol(); propDefCol.Add(propDef); IBOPropCol propCol = propDefCol.CreateBOPropertyCol(true); IRelProp relProp = relPropDef.CreateRelProp(propCol); Assert.AreEqual(relPropDef.OwnerPropertyName, relProp.OwnerPropertyName); Assert.AreEqual(relPropDef.RelatedClassPropName, relProp.RelatedClassPropName); Assert.IsFalse(relProp.IsNull); }
public static ClassDef CreateTestMapperClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("ShapeName", typeof(String), PropReadWriteRule.ReadWrite, "ShapeName", null); lPropDefCol.Add(propDef); propDef = new PropDef("ShapeID", typeof(Guid), PropReadWriteRule.WriteOnce, "ShapeID_field", null); lPropDefCol.Add(propDef); propDef = new PropDef("ShapeValue", typeof(Int32), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); // propDef = new PropDef("MyID", typeof(Guid), PropReadWriteRule.WriteOnce, null); // lPropDefCol.Add(propDef); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["ShapeID"]); KeyDefCol keysCol = new KeyDefCol(); KeyDef lKeyDef = new KeyDef(); lKeyDef.Add(lPropDefCol["ShapeName"]); keysCol.Add(lKeyDef); // RelKeyDef relKeyDef = new RelKeyDef(); //RelPropDef lRelPropDef = new RelPropDef(propDef, "OwnerID"); //relKeyDef.Add(lRelPropDef); //RelationshipDef relDef = new MultipleRelationshipDef("Owner", typeof (Shape), // relKeyDef, false, "", DeleteParentAction.DereferenceRelated); RelationshipDefCol relDefCol = new RelationshipDefCol(); //relDefCol.Add(relDef); ClassDef lClassDef = new ClassDef(typeof(Shape), primaryKey, "Shape_table", lPropDefCol, keysCol, relDefCol); ClassDef.ClassDefs.Add(lClassDef); return(lClassDef); }
public void Test_Add_ShouldSetPropDefsClassDef() { //---------------Set up test pack------------------- PropDef propDef = new PropDefFake(); PropDefCol col = new PropDefCol(); var expectedClassDef = MockRepository.GenerateStub <IClassDef>(); col.ClassDef = expectedClassDef; //---------------Assert Preconditions--------------- Assert.IsNull(propDef.ClassDef); //---------------Execute Test ---------------------- col.Add(propDef); //---------------Test Result ----------------------- Assert.AreSame(expectedClassDef, propDef.ClassDef); }
private new static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Colour", typeof(int), PropReadWriteRule.ReadWrite, "Colour", null); lPropDefCol.Add(propDef); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); //ClassDef lClassDef = new ClassDef(typeof (FilledCircleNoPrimaryKeyInheritsCircle), null, lPropDefCol, keysCol, relDefCol); ClassDef lClassDef = new ClassDef(typeof(FilledCircleNoPrimaryKeyInheritsCircle), null, "FilledCircle_table", lPropDefCol, keysCol, relDefCol, null); lClassDef.SuperClassDef = new SuperClassDef(Circle.GetClassDef(), ORMapping.ConcreteTableInheritance); ClassDef.ClassDefs.Add(lClassDef); return(lClassDef); }
private static ClassDef CreateTestClassDef(string suffix) { PropDefCol propDefCol = new PropDefCol(); PropDef propDef = new PropDef("TestProperty" + suffix, typeof(string), PropReadWriteRule.ReadWrite, null, null, false, false, 100, "Tested Property" + suffix, null); propDefCol.Add(propDef); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef { propDef }; var testClassDef = new ClassDef("Habanero.Test.Structure", "Person" + suffix, primaryKeyDef, propDefCol, new KeyDefCol(), new RelationshipDefCol(), new UIDefCol()); var uiGrid = new UIGrid(); testClassDef.UIDefCol.Add(new UIDef("UIDef1", new UIForm(), uiGrid)); return(testClassDef); }
public void TestAddDuplicationException() { //---------------Set up test pack------------------- PropDef propDef = new PropDef("prop", typeof(string), PropReadWriteRule.ReadWrite, null); PropDefCol col = new PropDefCol {propDef}; //---------------Execute Test ---------------------- try { col.Add(propDef); Assert.Fail("Expected to throw an ArgumentException"); } //---------------Test Result ----------------------- catch (ArgumentException ex) { StringAssert.Contains("A property definition with the name 'prop' already exists", ex.Message); } }
public void Test_Contains_WhenPropNameNull_ShouldReturnFalse() { //---------------Set up test pack------------------- PropDefCol propDefCol1 = new PropDefCol(); PropDef def = new PropDef("bob", typeof(string), PropReadWriteRule.ReadOnly, null); propDefCol1.Add(def); string propertyName = null; //---------------Assert Precondition---------------- Assert.Greater(propDefCol1.Count, 0); Assert.IsNull(propertyName); //---------------Execute Test ---------------------- bool contains = propDefCol1.Contains(propertyName); //---------------Test Result ----------------------- Assert.IsFalse(contains); }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); IPropDef propDef = new PropDef("FakeSuperClassID", typeof(Guid), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); PrimaryKeyDef primaryKey = new PrimaryKeyDef { IsGuidObjectID = true }; primaryKey.Add(lPropDefCol["FakeSuperClassID"]); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); ClassDef lClassDef = new ClassDef(typeof(FakeSuperClass), primaryKey, lPropDefCol, keysCol, relDefCol, null); ClassDef.ClassDefs.Add(lClassDef); return(lClassDef); }
public void TestAddDuplicationException() { //---------------Set up test pack------------------- PropDef propDef = new PropDef("prop", typeof(string), PropReadWriteRule.ReadWrite, null); PropDefCol col = new PropDefCol { propDef }; //---------------Execute Test ---------------------- try { col.Add(propDef); Assert.Fail("Expected to throw an ArgumentException"); } //---------------Test Result ----------------------- catch (ArgumentException ex) { StringAssert.Contains("A property definition with the name 'prop' already exists", ex.Message); } }
public void TestHasAutoIncrementingField() { PropDef propDef = new PropDef("prop", typeof(String), PropReadWriteRule.ReadWrite, null); PropDefCol propDefCol = new PropDefCol(); propDefCol.Add(propDef); ClassDef classDef = new ClassDef(typeof(String), null, propDefCol, null, null); Assert.IsFalse(classDef.HasAutoIncrementingField); PropDef propDef2 = new PropDef("prop2", "ass", "class", PropReadWriteRule.ReadWrite, "field", null, false, true); propDefCol.Add(propDef2); Assert.IsTrue(classDef.HasAutoIncrementingField); }
public void TestConstructors() { PropDef propDef = new PropDef("prop", typeof(String), PropReadWriteRule.ReadWrite, null); PropDefCol propDefCol = new PropDefCol(); propDefCol.Add(propDef); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef(); primaryKeyDef.Add(propDef); KeyDef keyDef = new KeyDef(); keyDef.Add(propDef); KeyDefCol keyDefCol = new KeyDefCol(); keyDefCol.Add(keyDef); RelPropDef relPropDef = new RelPropDef(propDef, "relProp"); RelKeyDef relKeyDef = new RelKeyDef(); relKeyDef.Add(relPropDef); //RelationshipDef relDef = new SingleRelationshipDef("rel", new BusinessObject().GetType(), relKeyDef, true); RelationshipDefCol relDefCol = new RelationshipDefCol(); //relDefCol.Add(relDef); UIDef uiDef = new UIDef("default", null, null); UIDefCol uiDefCol = new UIDefCol(); uiDefCol.Add(uiDef); ClassDef classDef = new ClassDef("ass", "class", null, null, null, null, null); Assert.AreEqual("ass", classDef.AssemblyName); Assert.AreEqual("class", classDef.ClassName); Assert.AreEqual("class", classDef.TableName); Assert.IsNull(classDef.PrimaryKeyDef); Assert.IsNull(classDef.PropDefcol); Assert.IsNull(classDef.KeysCol); Assert.IsNull(classDef.RelationshipDefCol); Assert.AreEqual(0, classDef.UIDefCol.Count); classDef = new ClassDef("ass", "class", primaryKeyDef, propDefCol, keyDefCol, relDefCol, uiDefCol); Assert.AreEqual("ass", classDef.AssemblyName); Assert.AreEqual("class", classDef.ClassName); Assert.AreEqual("class", classDef.TableName); Assert.AreEqual(1, classDef.PrimaryKeyDef.Count); Assert.AreEqual(1, classDef.PropDefcol.Count); Assert.AreEqual(1, classDef.KeysCol.Count); Assert.AreEqual(0, classDef.RelationshipDefCol.Count); Assert.AreEqual(1, classDef.UIDefCol.Count); classDef = new ClassDef(typeof(String), primaryKeyDef, "table", propDefCol, keyDefCol, relDefCol, uiDefCol); //Assert.AreEqual("db", classDef.); ? database has no usage Assert.AreEqual(typeof(String), classDef.ClassType); Assert.AreEqual("table", classDef.TableName); Assert.AreEqual(1, classDef.PrimaryKeyDef.Count); Assert.AreEqual(1, classDef.PropDefcol.Count); Assert.AreEqual(1, classDef.KeysCol.Count); Assert.AreEqual(0, classDef.RelationshipDefCol.Count); Assert.AreEqual(1, classDef.UIDefCol.Count); classDef = new ClassDef(typeof(String), primaryKeyDef, "table", propDefCol, keyDefCol, relDefCol); //Assert.AreEqual("db", classDef.); ? database has no usage Assert.AreEqual(typeof(String), classDef.ClassType); Assert.AreEqual("table", classDef.TableName); Assert.AreEqual(1, classDef.PrimaryKeyDef.Count); Assert.AreEqual(1, classDef.PropDefcol.Count); Assert.AreEqual(1, classDef.KeysCol.Count); Assert.AreEqual(0, classDef.RelationshipDefCol.Count); Assert.AreEqual(0, classDef.UIDefCol.Count); classDef = new ClassDef(typeof(String), primaryKeyDef, propDefCol, keyDefCol, relDefCol, uiDefCol); //Assert.AreEqual("db", classDef.); ? database has no usage Assert.AreEqual(typeof(String), classDef.ClassType); Assert.AreEqual("String", classDef.TableName); Assert.AreEqual(1, classDef.PrimaryKeyDef.Count); Assert.AreEqual(1, classDef.PropDefcol.Count); Assert.AreEqual(1, classDef.KeysCol.Count); Assert.AreEqual(0, classDef.RelationshipDefCol.Count); Assert.AreEqual(1, classDef.UIDefCol.Count); classDef = new ClassDef(typeof(String), primaryKeyDef, "table", propDefCol, keyDefCol, relDefCol, uiDefCol); //Assert.AreEqual("db", classDef.); ? database has no usage Assert.AreEqual(typeof(String), classDef.ClassType); Assert.AreEqual("table", classDef.TableName); Assert.AreEqual(1, classDef.PrimaryKeyDef.Count); Assert.AreEqual(1, classDef.PropDefcol.Count); Assert.AreEqual(1, classDef.KeysCol.Count); Assert.AreEqual(0, classDef.RelationshipDefCol.Count); Assert.AreEqual(1, classDef.UIDefCol.Count); }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); IPropDef propDef = new PropDef("FakeSuperClassID", typeof(Guid), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); PrimaryKeyDef primaryKey = new PrimaryKeyDef {IsGuidObjectID = true}; primaryKey.Add(lPropDefCol["FakeSuperClassID"]); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); ClassDef lClassDef = new ClassDef(typeof(FakeSuperClass), primaryKey, lPropDefCol, keysCol, relDefCol, null); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
private static PropDefCol CreateBOPropDef() { PropDefCol propDefCol = new PropDefCol(); propDefCol.Add("AddressID", typeof(Guid), PropReadWriteRule.WriteOnce, null); propDefCol.Add("ContactPersonID", typeof(Guid), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine1", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine2", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine3", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("AddressLine4", typeof(String), PropReadWriteRule.ReadWrite, null); propDefCol.Add("OrganisationID", typeof (Guid), PropReadWriteRule.ReadWrite, null); return propDefCol; }
public void TestEquals() { PropDefCol propDefCol1 = new PropDefCol(); PropDef def = new PropDef("bob", typeof (string), PropReadWriteRule.ReadOnly, null); propDefCol1.Add(def); PropDefCol propDefCol2 = new PropDefCol(); propDefCol2.Add(def); Assert.AreEqual(propDefCol1, propDefCol2); }
private static ClassDef CreateTestClassDef(string suffix) { PropDefCol propDefCol = new PropDefCol(); PropDef propDef = new PropDef("TestProperty" + suffix, typeof(string), PropReadWriteRule.ReadWrite, null, null, false, false, 100, "Tested Property" + suffix, null); propDefCol.Add(propDef); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef {propDef}; var testClassDef = new ClassDef("Habanero.Test.Structure", "Person" + suffix, primaryKeyDef, propDefCol, new KeyDefCol(), new RelationshipDefCol(), new UIDefCol()); var uiGrid = new UIGrid(); testClassDef.UIDefCol.Add(new UIDef("UIDef1", new UIForm(), uiGrid )); return testClassDef; }
protected static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Surname", typeof(String), PropReadWriteRule.ReadWrite, null); propDef.AddPropRule(new PropRuleString("ContactPerson-" + propDef.PropertyName, "", 2, 50, null)); lPropDefCol.Add(propDef); propDef = new PropDef("FirstName", typeof(String), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("DateOfBirth", typeof(DateTime), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); return lPropDefCol; }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Surname", "System", "String", PropReadWriteRule.ReadWrite, "Surname_field", null, true, false); propDef.AddPropRule(new PropRuleString("ContactPerson-" + propDef.PropertyName, "", 2, 50, null)); lPropDefCol.Add(propDef); propDef = new PropDef("FirstName", typeof(String), PropReadWriteRule.ReadWrite, "FirstName_field", null); lPropDefCol.Add(propDef); propDef = new PropDef("DateOfBirth", typeof(DateTime), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); //Create concurrency control properties propDef = new PropDef("DateLastUpdated", typeof(DateTime), PropReadWriteRule.ReadWrite, DateTime.Now); lPropDefCol.Add(propDef); propDef = new PropDef("UserLastUpdated", typeof(string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("MachineLastUpdated", typeof(string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("VersionNumber", typeof(int), PropReadWriteRule.ReadWrite, 1); lPropDefCol.Add(propDef); propDef = new PropDef("PK2Prop1", typeof(string), PropReadWriteRule.ReadWrite, "PK2_Prop1", null); lPropDefCol.Add(propDef); propDef = new PropDef("PK2Prop2", typeof(string), PropReadWriteRule.ReadWrite, "PK2_Prop2", null); lPropDefCol.Add(propDef); propDef = new PropDef("PK3Prop", typeof(string), PropReadWriteRule.WriteNew, "PK3_Prop", null); lPropDefCol.Add(propDef); lPropDefCol.Add("ContactPersonID", typeof(Guid), PropReadWriteRule.WriteOnce, null); return(lPropDefCol); }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); lPropDefCol.Add( new PropDef("SampleText", typeof (String), PropReadWriteRule.ReadWrite, "SampleText", null)); lPropDefCol.Add( new PropDef("SampleText2", typeof(String), PropReadWriteRule.ReadWrite, "SampleText2", null)); lPropDefCol.Add( new PropDef("SampleTextPrivate", typeof(String), PropReadWriteRule.ReadWrite, "SampleTextPrivate", null, false, false, int.MaxValue, null, null, true)); lPropDefCol.Add( new PropDef("SampleTextDescribed", typeof(String), PropReadWriteRule.ReadWrite, "SampleTextDescribed", null, false, false, int.MaxValue, null, "This is a sample text property that has a description.", false)); lPropDefCol.Add( new PropDef("SampleDate", typeof(DateTime), PropReadWriteRule.ReadWrite, "SampleDate", null)); lPropDefCol.Add( new PropDef("SampleDateNullable", typeof(DateTime), PropReadWriteRule.ReadWrite, "SampleDate", null)); lPropDefCol.Add( new PropDef("SampleBoolean", typeof (Boolean), PropReadWriteRule.ReadWrite, "SampleBoolean", null)); lPropDefCol.Add( new PropDef("SampleLookupID", typeof (Guid), PropReadWriteRule.ReadWrite, "SampleLookupID", null)); lPropDefCol.Add( new PropDef("SampleInt", typeof (int), PropReadWriteRule.ReadWrite, "SampleInt", 0)); lPropDefCol.Add( new PropDef("SampleMoney", typeof (Decimal), PropReadWriteRule.ReadWrite, "SampleInt", new Decimal(0))); PropDef propDef = new PropDef("SampleLookup2ID", typeof (Guid), PropReadWriteRule.ReadWrite, "SampleLookup2ID", null); itsLookupCollection = new Dictionary<string, string>(); itsLookupCollection.Add("Test1", new Guid("{6E8B3DDB-1B13-4566-868D-57478C1F4BEE}").ToString()); itsLookupCollection.Add("Test2",new Guid("{7209B956-96A0-4720-8E49-DE154FA0E096}").ToString()); itsLookupCollection.Add("Test3", new Guid("{F45DE850-C693-44d8-AC39-8CEE5435B21A}").ToString()); propDef.LookupList = new SimpleLookupList(itsLookupCollection); lPropDefCol.Add(propDef); lPropDefCol.Add(new PropDef("SampleLookup3ID", typeof (String), PropReadWriteRule.ReadWrite, "SampleLookup3ID", null)); PropDef def = new PropDef("SampleID", typeof (Guid), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(def); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["SampleID"]); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); return new ClassDef(typeof (Sample), primaryKey, lPropDefCol, keysCol, relDefCol); }
public void Test_Contains_WhenPropNameNull_ShouldReturnFalse() { //---------------Set up test pack------------------- PropDefCol propDefCol1 = new PropDefCol(); PropDef def = new PropDef("bob", typeof(string), PropReadWriteRule.ReadOnly, null); propDefCol1.Add(def); string propertyName = null; //---------------Assert Precondition---------------- Assert.Greater(propDefCol1.Count, 0); Assert.IsNull(propertyName); //---------------Execute Test ---------------------- bool contains = propDefCol1.Contains(propertyName); //---------------Test Result ----------------------- Assert.IsFalse(contains); }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); IPropDef propDef = new PropDef("EngineNo", typeof (String), PropReadWriteRule.ReadWrite, "ENGINE_NO", null); lPropDefCol.Add(propDef); propDef = lPropDefCol.Add("EngineID", typeof (Guid), PropReadWriteRule.WriteOnce, "Engine_ID", null); propDef = lPropDefCol.Add("CarID", typeof(Guid), PropReadWriteRule.ReadWrite, "CAR_ID", null); return lPropDefCol; }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef ("MockBOProp1", typeof (Guid), PropReadWriteRule.ReadWrite, "MockBOProp1", null, true, false); lPropDefCol.Add(propDef); lPropDefCol.Add("MockBOProp2", typeof (string), PropReadWriteRule.WriteOnce, "MockBOProp2", null); lPropDefCol.Add("MockBOID", typeof (Guid), PropReadWriteRule.WriteOnce, "MockBOID", null); return lPropDefCol; }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("TransactionSequenceNo", typeof (int), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("DateTimeUpdated", typeof (DateTime), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("WindowsUser", typeof (String), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); propDef = new PropDef("LogonUser", typeof (String), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("BusinessObjectTypeName", typeof (string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("CRUDAction", typeof (string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("DirtyXML", typeof (string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); propDef = new PropDef("MachineName", typeof (string), PropReadWriteRule.ReadOnly, null); lPropDefCol.Add(propDef); return lPropDefCol; }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Surname", "System", "String", PropReadWriteRule.ReadWrite, "Surname_field", null, true, false); propDef.AddPropRule(new PropRuleString("ContactPerson-" + propDef.PropertyName, "", 2, 50, null)); lPropDefCol.Add(propDef); propDef = new PropDef("FirstName", typeof(String), PropReadWriteRule.ReadWrite, "FirstName_field", null); lPropDefCol.Add(propDef); propDef = new PropDef("DateOfBirth", typeof (DateTime), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); //Create concurrency control properties propDef = new PropDef("DateLastUpdated", typeof(DateTime), PropReadWriteRule.ReadWrite, DateTime.Now); lPropDefCol.Add(propDef); propDef = new PropDef("UserLastUpdated", typeof(string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("MachineLastUpdated", typeof(string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("VersionNumber", typeof(int), PropReadWriteRule.ReadWrite, 1); lPropDefCol.Add(propDef); propDef = new PropDef("PK2Prop1", typeof(string), PropReadWriteRule.ReadWrite, "PK2_Prop1", null); lPropDefCol.Add(propDef); propDef = new PropDef("PK2Prop2", typeof(string), PropReadWriteRule.ReadWrite, "PK2_Prop2", null); lPropDefCol.Add(propDef); propDef = new PropDef("PK3Prop", typeof (string), PropReadWriteRule.WriteNew, "PK3_Prop", null); lPropDefCol.Add(propDef); lPropDefCol.Add("ContactPersonID", typeof (Guid), PropReadWriteRule.WriteOnce, null); return lPropDefCol; }
protected static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("Surname", typeof (String), PropReadWriteRule.ReadWrite, null); propDef.AddPropRule( new PropRuleString("ContactPerson-" + propDef.PropertyName, "", 2, 50, null)); lPropDefCol.Add(propDef); propDef = new PropDef("FirstName", typeof (String), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("DateOfBirth", typeof (DateTime), PropReadWriteRule.WriteOnce, null); lPropDefCol.Add(propDef); //Create concurrency control properties propDef = new PropDef("DateLastUpdated", typeof (DateTime), PropReadWriteRule.ReadWrite, DateTime.Now); lPropDefCol.Add(propDef); propDef = new PropDef("UserLastUpdated", typeof (string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("MachineLastUpdated", typeof (string), PropReadWriteRule.ReadWrite, null); lPropDefCol.Add(propDef); propDef = new PropDef("VersionNumber", typeof (int), PropReadWriteRule.ReadWrite, 1); lPropDefCol.Add(propDef); propDef = new PropDef(PK1_PROP1_NAME, typeof (string), PropReadWriteRule.ReadWrite, "PK1_Prop1", null); lPropDefCol.Add(propDef); propDef = new PropDef(PK1_PROP2_NAME, typeof (string), PropReadWriteRule.ReadWrite, "PK1_Prop2", null); lPropDefCol.Add(propDef); return lPropDefCol; }
private static PropDefCol CreateBOPropDef() { PropDefCol lPropDefCol = new PropDefCol(); PropDef propDef = new PropDef("CarRegNo", typeof (String), PropReadWriteRule.ReadWrite, "CAR_REG_NO", null); lPropDefCol.Add(propDef); lPropDefCol.Add("OwnerId", typeof (Guid), PropReadWriteRule.ReadWrite, "OWNER_ID", null); lPropDefCol.Add("CarID", typeof (Guid), PropReadWriteRule.WriteOnce, "CAR_ID", null); lPropDefCol.Add("DriverFK1", typeof (String), PropReadWriteRule.WriteOnce, "Driver_FK1", null); lPropDefCol.Add("DriverFK2", typeof (String), PropReadWriteRule.WriteOnce, "Driver_FK2", null); return lPropDefCol; }
private static ClassDef CreateClassDef(long number, bool hasSingleRelationship, bool hasMultipleRelationship, bool hasMultipleRelationshipWithPreventDelete) { const string assemblyName = "Habanero.Test.BO"; const string className = "TestBO"; const string idPropName = "MyBoID"; const string fkPropertyName = "MyParentBoID"; string suffix = number.ToString(); PropDefCol propDefCol = new PropDefCol(); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef(); primaryKeyDef.IsGuidObjectID = false; RelationshipDefCol relationshipDefCol = new RelationshipDefCol(); PropDef idPropDef = new PropDef(idPropName, typeof(string), PropReadWriteRule.ReadWrite, ""); propDefCol.Add(idPropDef); primaryKeyDef.Add(idPropDef); //propDef = new PropDef("MyProp", typeof(string), PropReadWriteRule.ReadWrite, "" ); //propDefCol.Add(propDef); PropDef propDef = new PropDef(fkPropertyName, typeof(string), PropReadWriteRule.ReadWrite, ""); propDefCol.Add(propDef); if (hasSingleRelationship) { string relatedClassSuffix = (number - 1).ToString(); RelKeyDef relKeyDef = new RelKeyDef(); RelPropDef relPropDef = new RelPropDef(propDef, idPropName); relKeyDef.Add(relPropDef); SingleRelationshipDef singleRelationshipDef = new SingleRelationshipDef( "MyParent", assemblyName, className + relatedClassSuffix, relKeyDef, false, DeleteParentAction.Prevent); relationshipDefCol.Add(singleRelationshipDef); } if (hasMultipleRelationship) { string relatedClassSuffix = (number + 1).ToString(); RelKeyDef relKeyDef = new RelKeyDef(); RelPropDef relPropDef = new RelPropDef(idPropDef, fkPropertyName); relKeyDef.Add(relPropDef); MultipleRelationshipDef multipleRelationshipDef = new MultipleRelationshipDef("MyBO" + relatedClassSuffix, assemblyName, className + relatedClassSuffix, relKeyDef, false, "", DeleteParentAction.DeleteRelated); relationshipDefCol.Add(multipleRelationshipDef); } if (hasMultipleRelationshipWithPreventDelete) { string relatedClassSuffix = (number + 1).ToString(); RelKeyDef relKeyDef = new RelKeyDef(); RelPropDef relPropDef = new RelPropDef(idPropDef, fkPropertyName); relKeyDef.Add(relPropDef); MultipleRelationshipDef multipleRelationshipDef = new MultipleRelationshipDef("MyPreventBO" + relatedClassSuffix, assemblyName, className + relatedClassSuffix, relKeyDef, false, "", DeleteParentAction.Prevent); relationshipDefCol.Add(multipleRelationshipDef); } ClassDef classDef = new ClassDef(assemblyName, className + suffix, primaryKeyDef, propDefCol, new KeyDefCol(), relationshipDefCol, new UIDefCol()); return(classDef); }
private static ClassDef CreateTestClassDef(string suffix) { PropDefCol propDefCol = new PropDefCol(); PropDef propDef = new PropDef("TestProperty" + suffix, typeof(string), PropReadWriteRule.ReadWrite, null, null, false, false, 100, "Tested Property" + suffix, "This is a property for testing."); propDefCol.Add(propDef); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef {propDef}; return new ClassDef("TestAssembly", "TestClass" + suffix, primaryKeyDef, propDefCol, new KeyDefCol(), new RelationshipDefCol(), new UIDefCol()); }