protected void ProcessMemberDataT(XmlNode memberNode) { var fullName = memberNode.Attributes["name"].InnerText.Split(':')[1]; Type type = Type.GetType(fullName + ", " + AssemblyDef.AssemblyName); var def = ClassDef.FromType(type); XmlNode node; for (int i = 0; i < memberNode.ChildNodes.Count; i++) { node = memberNode.ChildNodes[i]; switch (node.Name) { case "summary": def.Summary = node.InnerText; break; case "remarks": def.Remarks = node.InnerText; break; } } AssemblyDef.ClassDefs.Add(type, def); }
/// <summary> /// Generates a collection of sql statements to insert the business /// object's properties into the database /// </summary> /// <returns>Returns a sql statement collection</returns> public IEnumerable<ISqlStatement> Generate() { _statements = new List<ISqlStatement>(); _currentClassDef = _bo.ClassDef; IBOPropCol propsToInclude; string tableName; propsToInclude = GetPropsToInclude(_currentClassDef); tableName = StatementGeneratorUtils.GetTableName(_bo); GenerateSingleInsertStatement(propsToInclude, tableName); if (_bo.ClassDef.IsUsingClassTableInheritance()) { _currentClassDef = (ClassDef) _bo.ClassDef.SuperClassClassDef; while (_currentClassDef.IsUsingClassTableInheritance()) { propsToInclude = GetPropsToInclude(_currentClassDef); tableName = _currentClassDef.TableName; GenerateSingleInsertStatement(propsToInclude, tableName); _currentClassDef = (ClassDef) _currentClassDef.SuperClassClassDef; } propsToInclude = GetPropsToInclude(_currentClassDef); tableName = _currentClassDef.InheritedTableName; GenerateSingleInsertStatement(propsToInclude, tableName); } return _statements; }
public static ClassDef CreateClassDef() { 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("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 string GenerateLoadSwitch(string template, ClassDef c) { string t = template; string rep = ""; foreach (PropDef p in c.props) { string type = PropertyReader.TypeToString(p.type); switch (type) { case "Bool Property": rep += "\t\t\t\t\tcase \"" + p.name + "\":\r\n"; rep += "\t\t\t\t\t\tif (p.raw[p.raw.Length - 1] == 1)\r\n"; rep += "\t\t\t\t\t\t" + p.name + " = true;\r\n"; rep += "\t\t\t\t\t\tbreak;\r\n"; break; case "Integer Property": case "Object Property": case "Name Property": case "Byte Property": rep += "\t\t\t\t\tcase \"" + p.name + "\":\r\n"; rep += "\t\t\t\t\t\t" + p.name + " = p.Value.IntValue;\r\n"; rep += "\t\t\t\t\t\tbreak;\r\n"; break; case "Float Property": rep += "\t\t\t\t\tcase \"" + p.name + "\":\r\n"; rep += "\t\t\t\t\t\t" + p.name + " = BitConverter.ToSingle(p.raw, p.raw.Length - 4);\r\n"; rep += "\t\t\t\t\t\tbreak;\r\n"; break; } } return t.Replace("**LOADINGSWITCH**", rep); }
public void VisitClass(ClassDef c) { if (VisitDecorators(c)) { return; } var baseClasses = c.args.Select(a => GenerateBaseClassName(a.defval !)).ToList(); var comments = ConvertFirstStringToComments(c.body.stmts); var gensym = new SymbolGenerator(); var stmtXlt = new StatementTranslator(c, types, gen, gensym, new HashSet <string>()); stmtXlt.properties = FindProperties(c.body.stmts); var csClass = gen.Class( c.name.Name, baseClasses, () => GenerateFields(c), () => c.body.Accept(stmtXlt)); csClass.Comments.AddRange(comments); if (customAttrs != null) { csClass.CustomAttributes.AddRange(customAttrs); customAttrs = null; } }
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 Test_ShouldHavePropertyMapped_WhenPropSetterMappedToInvalidName_ShouldAssertFalse() { BORegistry.DataAccessor = new DataAccessorInMemory(); //---------------Set up test pack------------------- const string relName = "SingleRelSetterMappedToNonExistentRelDef"; CreateClassDefs <FakeBOWithNothing, FakeBoWithSingleRel>(); var classDef = ClassDef.Get <FakeBoWithSingleRel>(); var boTester = CreateTester <FakeBoWithSingleRel>(); var singleRelDefTester = boTester.GetSingleRelationshipTester(rel => rel.SingleRelSetterMappedToNonExistentRelDef); //---------------Assert Precondition---------------- classDef.ShouldHaveSingleRelationshipDef(relName); classDef.ShouldHavePropertyInfo(relName); //---------------Execute Test ---------------------- try { singleRelDefTester.ShouldHavePropertyMapped(); Assert.Fail("Expected to throw an AssertionException "); } //---------------Test Result ----------------------- catch (AssertionException ex) { string expected = string.Format("The Setter for the Property '{0}' for class '{1}'", relName, "FakeBoWithSingleRel"); StringAssert.Contains(expected, ex.Message); StringAssert.Contains("Setting the Property via reflection failed", ex.Message); } }
private static ClassDef GetClassDef() { PropDef propDefPK = new PropDef(ENUM_PKPROP_NAME, typeof(Guid), PropReadWriteRule.WriteNew, null); PropDef propDef = new PropDef(ENUM_PROP_NAME, typeof(TestEnum), PropReadWriteRule.ReadWrite, TestEnum.Option1); PropDef propDef2 = new PropDef(ENUM_PROP_NAME_EMPTY, typeof(TestEnumEmpty), PropReadWriteRule.ReadWrite, null); PropDef propDef3 = new PropDef(ENUM_PROP_NAME_PASCAL, typeof(TestEnumPascalCase), PropReadWriteRule.ReadWrite, null); PrimaryKeyDef primaryKeyDef = new PrimaryKeyDef { propDefPK }; PropDefCol propDefCol = new PropDefCol { propDefPK, propDef, propDef2, propDef3 }; UIFormField uiFormField = new UIFormField(TestUtil.GetRandomString(), propDef.PropertyName, typeof(IComboBox), "EnumComboBoxMapper", "Habanero.Faces.Base", true, null, null, LayoutStyle.Label); UIFormColumn uiFormColumn = new UIFormColumn { uiFormField }; UIFormTab uiFormTab = new UIFormTab { uiFormColumn }; UIForm uiForm = new UIForm { uiFormTab }; UIDef uiDef = new UIDef("default", uiForm, null); UIDefCol uiDefCol = new UIDefCol { uiDef }; ClassDef classDef = new ClassDef(typeof(EnumBO), primaryKeyDef, propDefCol, new KeyDefCol(), null, uiDefCol); return(classDef); }
public string GenerateTree(string template, ClassDef c) { string t = template; string rep = ""; foreach (PropDef p in c.props) { string type = PropertyReader.TypeToString(p.type); switch (type) { case "Object Property": case "Integer Property": case "Bool Property": case "Float Property": rep += "\t\t\tres.Nodes.Add(\"" + p.name + " : \" + " + p.name + ");\r\n"; break; case "Name Property": case "Byte Property": rep += "\t\t\tres.Nodes.Add(\"" + p.name + " : \" + pcc.getNameEntry(" + p.name + "));\r\n"; break; } } return(t.Replace("**TREEGEN**", rep)); }
/// <summary> /// Constructor as before, but allows a UIDefName to be specified /// </summary> /// <param name="listView">The ListView object to map</param> /// <param name="classDef">the class defintion of the class that this controller is setting up the list view for</param> /// <param name="uiDefName">The ui definition that the list view be set up for i.e. the properties that will be shown in the list view</param> public ListViewCollectionController(IListView listView, ClassDef classDef, string uiDefName) { _listView = listView; _classDef = classDef; _uiDefName = uiDefName; //_listItemsHash = new Hashtable(); }
public void Test_CreateMultipleRelationshipDef_Association() { //---------------Set up test pack------------------- BORegistry.DataAccessor = new DataAccessorInMemory(); ClassDef.ClassDefs.Clear(); OrganisationTestBO.LoadDefaultClassDef(); ContactPersonTestBO.LoadDefaultClassDef(); RelPropDef relPropDef = new RelPropDef(ClassDef.Get <OrganisationTestBO>().PropDefcol["OrganisationID"], "OrganisationID"); RelKeyDef relKeyDef = new RelKeyDef(); relKeyDef.Add(relPropDef); const int expectedTimeout = 550; MultipleRelationshipDef relationshipDef = new MultipleRelationshipDef("ContactPeople", "Habanero.Test.BO", "ContactPersonTestBO", relKeyDef, true, "", DeleteParentAction.DeleteRelated, InsertParentAction.InsertRelationship, RelationshipType.Association, expectedTimeout); OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation(); //---------------Assert Precondition---------------- Assert.AreEqual(expectedTimeout, relationshipDef.TimeOut); //---------------Execute Test ---------------------- MultipleRelationship <ContactPersonTestBO> relationship = (MultipleRelationship <ContactPersonTestBO>)relationshipDef.CreateRelationship(organisation, organisation.Props); //---------------Test Result ----------------------- Assert.AreEqual(expectedTimeout, relationship.TimeOut); Assert.AreEqual(InsertParentAction.InsertRelationship, relationship.RelationshipDef.InsertParentAction); }
private Type GetComboBoxMapperType <T>(Control control) where T : class, IBusinessObject { //Note_ the Naming convention is only needed in the registry to deal with // ComboBoxes since they could be enum, Relationship or lookups so have to // get the property name to resolve. string propName = ControlNamingConvention.GetPropName(control); var classDef = ClassDef.Get <T>(); var propDef = classDef.GetPropDef(propName, false); if (propDef == null) { var relationshipDef = classDef.GetRelationship(propName) as ISingleRelationshipDef; if (relationshipDef != null) { return(typeof(AutoLoadingRelationshipComboBoxMapper)); } else { //ToDo: some sort of reflective stuff since this is a reflective prop } return(null); } if (propDef.PropertyType.ToTypeWrapper().IsEnumType()) { return(typeof(EnumComboBoxMapper)); } if (propDef.HasLookupList()) { return(typeof(LookupComboBoxMapper)); } return(null); }
public string GenerateLoadSwitch(string template, ClassDef c) { string t = template; string rep = ""; foreach (PropDef p in c.props) { string type = PropertyReader.TypeToString(p.type); switch (type) { case "Bool Property": rep += "\t\t\t\t\tcase \"" + p.name + "\":\r\n"; rep += "\t\t\t\t\t\tif (p.raw[p.raw.Length - 1] == 1)\r\n"; rep += "\t\t\t\t\t\t" + p.name + " = true;\r\n"; rep += "\t\t\t\t\t\tbreak;\r\n"; break; case "Integer Property": case "Object Property": case "Name Property": case "Byte Property": rep += "\t\t\t\t\tcase \"" + p.name + "\":\r\n"; rep += "\t\t\t\t\t\t" + p.name + " = p.Value.IntValue;\r\n"; rep += "\t\t\t\t\t\tbreak;\r\n"; break; case "Float Property": rep += "\t\t\t\t\tcase \"" + p.name + "\":\r\n"; rep += "\t\t\t\t\t\t" + p.name + " = BitConverter.ToSingle(p.raw, p.raw.Length - 4);\r\n"; rep += "\t\t\t\t\t\tbreak;\r\n"; break; } } return(t.Replace("**LOADINGSWITCH**", rep)); }
/// <summary> /// ε»Ίη« θ εε§ε Create Command Handler for (CQRS) /// </summary> /// <param name="project"></param> /// <param name="currentFolder"></param> /// <param name="commandClassName"></param> /// <param name="dtoClassName"></param> public static void CreateCQRSCreateCommandClassFromSource(Project project, ProjectItem currentFolder, string commandClassName, string dtoClassName) { Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); SQLStore store = new SQLStore(); StringBuilder sb = new StringBuilder(); int columnOrder = 0; string commandHandlerDefined = CreateCommandDef.GetClassTemplate; commandHandlerDefined = commandHandlerDefined.Replace("$(NAMESPACE_DEF)$", string.Format("{0}", project.Name)); commandHandlerDefined = commandHandlerDefined.Replace("$(CREATE_COMMAND_NAME)$", commandClassName); ClassDef.GetClassProperties(store.GetNoDataDataTableByName(dtoClassName), new string[] { }, sb, columnOrder); commandHandlerDefined = commandHandlerDefined.Replace("$(CLASS_PROPERTIES_DEF)$", sb.ToString()); string CommandHandlerFileName = $"Create{commandClassName}Command.cs"; //η’η CQRS Create Command ζͺζ‘οΌδΈ¦ε ζ«ζΎε¨ Temp θ³ζε€ΎδΈ. string TempPath = AddFile2ProjectItem(currentFolder, commandHandlerDefined, CommandHandlerFileName); //εͺι€ζζ«εζͺζ‘ try { File.Delete(TempPath); } catch (Exception ex) { } //εͺι€ζ«εζͺζ‘θ₯ε€±ζδΈθηδ»»δ½θ¨ζ―. }
public void Visit(ClassDef node) { currentType = Context.GetType(node.Type); if (node.typeInherited != null) { IType t; if ((t = Context.GetType(node.typeInherited)) != null) { currentType.TypeInherited = t; t.ChildTypes.Add(currentType); } else { errorLog.LogError(string.Format(TYPEINHERITEDDOESNEXIST, node.Line, currentType.Name, node.typeInherited)); } } else { var obj = currentType.TypeInherited = Context.GetType("Object"); obj.ChildTypes.Add(currentType); } foreach (var item in node.Attributes) { Visit(item); } foreach (var item in node.Methods) { Visit(item); } currentType.DefineAttribute("self", currentType); }
public void TestLoadNumberGenClassDef_ShouldAddClassDef_BUGFIX_ShouldBeThreadSafe() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- Assert.AreEqual(0, ClassDef.ClassDefs.Count); //---------------Execute Test ---------------------- var exceptions = new List <Exception>(); TestUtil.ExecuteInParallelThreads(2, () => { try { BOSequenceNumber.LoadNumberGenClassDef(); } catch (Exception ex) { exceptions.Add(ex); } }); //---------------Test Result ----------------------- if (exceptions.Count > 0) { Assert.Fail(exceptions[0].ToString()); } Assert.AreEqual(1, ClassDef.ClassDefs.Count); Assert.IsNotNull(ClassDef.Get <BOSequenceNumber>()); }
private static void PrepareSourceTree(Source currentSource, ref ClassDef currentClassDef) { while (currentSource != null) { Source childSource = currentSource.ChildSource; currentSource.EntityName = currentClassDef.GetTableName(); if (childSource != null) { string relationshipName = childSource.Name; IRelationshipDef relationshipDef = currentClassDef.GetRelationship(relationshipName); if (relationshipDef == null) { string message = string.Format("'{0}' does not have a relationship called '{1}'.", currentClassDef.ClassName, relationshipName); throw new RelationshipNotFoundException(message); } foreach (RelPropDef relPropDef in relationshipDef.RelKeyDef) { string ownerFieldName = currentClassDef.GetPropDef(relPropDef.OwnerPropertyName).DatabaseFieldName; string relatedFieldName = relationshipDef.RelatedObjectClassDef.GetPropDef(relPropDef.RelatedClassPropName).DatabaseFieldName; QueryField fromField = new QueryField(relPropDef.OwnerPropertyName, ownerFieldName, currentSource); QueryField toField = new QueryField(relPropDef.RelatedClassPropName, relatedFieldName, childSource); currentSource.Joins[0].JoinFields.Add(new Source.Join.JoinField(fromField, toField)); } currentClassDef = (ClassDef)relationshipDef.RelatedObjectClassDef; } currentSource = childSource; } }
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 static ClassDef CreateClassDef() { PropDefCol lPropDefCol = CreateBOPropDef(); KeyDef lKeyDef = new KeyDef(); lKeyDef.IgnoreIfNull = true; lKeyDef.Add(lPropDefCol["PK2Prop1"]); lKeyDef.Add(lPropDefCol["PK2Prop2"]); KeyDefCol keysCol = new KeyDefCol(); keysCol.Add(lKeyDef); lKeyDef = new KeyDef(); lKeyDef.IgnoreIfNull = false; lKeyDef.Add(lPropDefCol["PK3Prop"]); keysCol.Add(lKeyDef); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["ContactPersonID"]); //Releationships RelationshipDefCol relDefs = CreateRelationshipDefCol(lPropDefCol); ClassDef lClassDef = new ClassDef(typeof(ContactPerson), primaryKey, "contact_person", lPropDefCol, keysCol, relDefs); ClassDef.ClassDefs.Add(lClassDef); return(lClassDef); }
public void Test_GetSuperClassClassDef_WithTypeParameter() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); ClassDefCol classDefCol = new ClassDefCol(); ClassDef classDef1 = new ClassDef("Habanero.Test.BO", "UnknownClass", null, null, null, null, null); classDef1.TypeParameter = "TypeParam1"; classDefCol.Add(classDef1); ClassDef classDef2 = new ClassDef("Habanero.Test.BO", "UnknownClass", null, null, null, null, null); classDef2.TypeParameter = "TypeParam2"; classDefCol.Add(classDef2); SuperClassDef superClassDef = new SuperClassDef(classDef2.AssemblyName, classDef2.ClassNameExcludingTypeParameter, ORMapping.ClassTableInheritance, null, null); superClassDef.TypeParameter = classDef2.TypeParameter; //---------------Assert Precondition---------------- Assert.AreEqual(0, ClassDef.ClassDefs.Count); Assert.AreEqual(2, classDefCol.Count); //---------------Execute Test ---------------------- IClassDef def = ClassDefHelper.GetSuperClassClassDef(superClassDef, classDefCol); //---------------Test Result ----------------------- Assert.IsNotNull(def); Assert.AreSame(classDef2, def); }
public void Test_GetSuperClassClassDef_NotFound() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); ClassDef classDef = new ClassDef("Habanero.Test.BO", "UnknownClass", null, null, null, null, null); ClassDef.ClassDefs.Add(classDef); SuperClassDef superClassDef = new SuperClassDef(classDef.AssemblyName, classDef.ClassName, ORMapping.ClassTableInheritance, null, null); ClassDefCol classDefCol = new ClassDefCol(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- try { ClassDefHelper.GetSuperClassClassDef(superClassDef, classDefCol); //---------------Test Result ----------------------- Assert.Fail("Expected to throw an InvalidXmlDefinitionException"); } catch (InvalidXmlDefinitionException ex) { StringAssert.Contains("The class definition for the super class with the type " + "'Habanero.Test.BO.UnknownClass' was not found. Check that the class definition " + "exists or that spelling and capitalisation are correct. " + "There are 0 class definitions currently loaded.", ex.Message); } }
internal ClassLayout(ushort pack, uint cSize, ClassDef par) { packSize = pack; classSize = cSize; parent = par; tabIx = MDTable.ClassLayout; }
public ClassDef AddDefinition(string name_space, string name, TypeAttr attr, Location location) { string full_name; if (name_space != null) { full_name = String.Format("{0}.{1}", name_space, name); } else { full_name = name; } ClassTableItem item = (ClassTableItem)table[full_name]; if (item == null) { ClassDef klass = pefile.AddClass(attr, name_space, name); AddDefined(full_name, klass, location); return(klass); } item.Class.AddAttribute(attr); item.Defined = true; return(item.Class); }
/// <summary> /// Creates a panel with a grid containing the business object /// information /// </summary> /// <param name="formGrid">The grid to fill</param> /// <returns>Returns the object containing the panel</returns> private PanelFactoryInfo CreatePanelWithGrid(IUIFormGrid formGrid) { IEditableGridControl myGrid = _controlFactory.CreateEditableGridControl(); BusinessObject bo = _currentBusinessObject; ClassDef classDef = bo.ClassDef; DataSetProvider dataSetProvider = myGrid.Grid.DataSetProvider as DataSetProvider; if (dataSetProvider != null) { dataSetProvider.ObjectInitialiser = new RelationshipObjectInitialiser(bo, (RelationshipDef)classDef.GetRelationship(formGrid.RelationshipName), formGrid.CorrespondingRelationshipName); } IBusinessObjectCollection collection = bo.Relationships.GetRelatedCollection(formGrid.RelationshipName); myGrid.SetBusinessObjectCollection(collection); myGrid.Dock = DockStyle.Fill; IPanel panel = _controlFactory.CreatePanel(formGrid.RelationshipName, _controlFactory); panel.Controls.Add(myGrid); PanelFactoryInfo panelFactoryInfo = new PanelFactoryInfo(panel); panelFactoryInfo.FormGrids.Add(formGrid.RelationshipName, myGrid); return(panelFactoryInfo); }
public ClassDef AddDefinition(string name_space, string name, TypeAttr attr, Class parent, Location location) { string full_name; if (name_space != null) { full_name = String.Format("{0}.{1}", name_space, name); } else { full_name = name; } ClassTableItem item = (ClassTableItem)table[full_name]; if (item == null) { ClassDef klass = pefile.AddClass(attr, name_space, name, parent); AddDefined(full_name, klass, location); return(klass); } /// TODO: Need to set parent, will need to modify PEAPI for this. item.Class.AddAttribute(attr); item.Defined = true; return(item.Class); }
[Test] // Checks that deleting this instance has no effect in the related class public void Test_SingleRelationshipDeletion_DoNothing_Car() { CheckIfTestShouldBeIgnored(); //---------------Set up test pack------------------- Driver driver = TestUtilsDriver.CreateSavedDriver(); TestProject.BO.Car boForRelationshipCar = TestUtilsCar.CreateSavedCar(); driver.Car = boForRelationshipCar; driver.Save(); //---------------Assert Preconditions--------------- IRelationshipDef relationshipDef = ClassDef.Get <Driver>().RelationshipDefCol["Car"]; Assert.AreEqual(DeleteParentAction.DoNothing, relationshipDef.DeleteParentAction); //---------------Execute Test ---------------------- driver.MarkForDelete(); driver.Save(); //---------------Execute Test ---------------------- BusinessObjectManager.Instance.ClearLoadedObjects(); GC.Collect(); TestUtilsShared.WaitForGC(); try { Broker.GetBusinessObject <Driver>(driver.ID); Assert.Fail("BO should no longer exist and exception should be thrown"); } catch (BusObjDeleteConcurrencyControlException ex) { StringAssert.Contains("There are no records in the database for the Class: Driver", ex.Message); } TestProject.BO.Car relatedBO = Broker.GetBusinessObject <TestProject.BO.Car>(boForRelationshipCar.ID); Assert.AreEqual(relatedBO.ID.ToString(), boForRelationshipCar.ID.ToString()); }
[Test] // Checks that deletion is prevented when a child exists public void Test_MultipleRelationshipDeletion_PreventDelete_Drivers() { CheckIfTestShouldBeIgnored(); //---------------Set up test pack------------------- Car car = TestUtilsCar.CreateSavedCar(); TestProject.BO.Driver boForRelationshipDrivers = TestUtilsDriver.CreateUnsavedValidDriver(); boForRelationshipDrivers.CarID = car.VehicleID; boForRelationshipDrivers.Save(); //---------------Assert Preconditions--------------- Assert.AreEqual(1, car.Drivers.Count); IRelationshipDef relationshipDef = ClassDef.Get <Car>().RelationshipDefCol["Drivers"]; Assert.AreEqual(DeleteParentAction.Prevent, relationshipDef.DeleteParentAction); //---------------Execute Test ---------------------- try { car.MarkForDelete(); car.Save(); Assert.Fail("Should have thrown exception due to deletion prevention"); } //---------------Test Result ----------------------- catch (BusObjDeleteException ex) { StringAssert.Contains("You cannot delete Car identified by ", ex.Message); StringAssert.Contains("via the Drivers relationship", ex.Message); } }
private void loadDB(string fileName) { FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); int count = ReadInt(fs); Classes = new List <ClassDef>(); pb1.Maximum = count + 1; for (int i = 0; i < count; i++) { if (i % 10 == 0) { pb1.Value = i; Application.DoEvents(); } ClassDef tmp = new ClassDef(); tmp.name = ReadString(fs); int pcount = ReadInt(fs); tmp.props = new List <PropDef>(); for (int j = 0; j < pcount; j++) { PropDef p = new PropDef(); p.name = ReadString(fs); p.type = ReadInt(fs); p.ffpath = ReadString(fs); p.ffidx = ReadInt(fs); tmp.props.Add(p); } Classes.Add(tmp); } fs.Close(); Sort(); RefreshLists(); Properties.Settings.Default.PropertyDBPath = fileName; }
public int hashCode() { int hash = 37; ClassDef def = _defRef.get(); QuercusClass parent = null; if (_parentRef != null) { parent = _parentRef.get(); } if (def != null) { hash = 65521 * hash + def.hashCode(); } if (parent != null) { hash = 65521 * hash + parent.hashCode(); } return(hash); }
/// <summary> /// Constructor as before, but allows a UIDefName to be specified /// </summary> /// <param name="listView">The ListView object to map</param> /// <param name="classDef">the class defintion of the class that this controller is setting up the list view for</param> /// <param name="uiDefName">The ui definition that the list view be set up for i.e. the properties that will be shown in the list view</param> public ListViewCollectionController(IListView listView,ClassDef classDef, string uiDefName) { _listView = listView; _classDef = classDef; _uiDefName = uiDefName; //_listItemsHash = new Hashtable(); }
///<summary> /// Returns the <see cref="ClassDef"/> for the super class defined in the specified <see cref="SuperClassDef"/>. ///</summary> ///<param name="superClassDef">The <see cref="SuperClassDef"/> for which to find its Super class <see cref="ClassDef"/>.</param> ///<param name="classDefCol">The <see cref="ClassDefCol"/> to use to search for the super class <see cref="ClassDef"/>.</param> ///<returns>Returns the <see cref="ClassDef"/> for the super class defined in the specified <see cref="SuperClassDef"/>.</returns> ///<exception cref="InvalidXmlDefinitionException"></exception> public static ClassDef GetSuperClassClassDef(ISuperClassDef superClassDef, ClassDefCol classDefCol) { ClassDef superClassClassDef = null; string assemblyName = superClassDef.AssemblyName; string className = superClassDef.ClassName; if (assemblyName != null && className != null) { if (!string.IsNullOrEmpty(superClassDef.TypeParameter)) { className = className + "_" + superClassDef.TypeParameter; } if (classDefCol.Contains(assemblyName, className)) { superClassClassDef = (ClassDef)classDefCol[assemblyName, className]; } if (superClassClassDef == null) { throw new InvalidXmlDefinitionException(String.Format( "The class definition for the super class with the type " + "'{0}' was not found. Check that the class definition " + "exists or that spelling and capitalisation are correct. " + "There are {1} class definitions currently loaded." , assemblyName + "." + className, classDefCol.Count)); } } return(superClassClassDef); }
public void TestFieldToolTipFromClassDef() { ClassDef classDef = CreateTestClassDef(""); UIFormField uiFormField = new UIFormField(null, "TestProperty", typeof(TextBox), null, null, true, null, null, LayoutStyle.Label); Assert.AreEqual("This is a property for testing.", uiFormField.GetToolTipText(classDef)); }
private void PrepareClassDefFields(ClassDef result) { for (short i = 0; i < result.Meta.Items.Count; ++i) { var yi = result.Meta.Items[i]; short j = (short)(i + 1); // Capture. var wf = GetWriteFunc(yi.Type); var fd = new ClassDef.FieldDef { Name = yi.Tag(Options), Type = yi.Type }; if (yi.SerializeCond != null) { fd.WriteFunc = obj => { var value = yi.GetValue(obj); if (!yi.SerializeCond(obj, value)) { return; } writer.Write(j); wf(value); } } ; else { fd.WriteFunc = obj => { writer.Write(j); wf(yi.GetValue(obj)); } }; fd.WriteFuncCompact = obj => wf(yi.GetValue(obj)); result.Fields.Add(fd); } }
public void Test_GetValidPropValue_WhenStringAndMaxLengthWhenPropName_ShouldRetValidValue() { //---------------Set up test pack------------------- var classDef = ClassDef.Get <FakeBO>(); var def = classDef.PropDefcol.FirstOrDefault(propDef => propDef.PropertyName == "CompulsoryString"); //---------------Assert Precondition---------------- Assert.IsNotNull(def); def.AddPropRule(CreatePropRuleString(3, 7)); var factory = new BOTestFactory(typeof(FakeBO)); Assert.AreSame(typeof(string), def.PropertyType); Assert.IsNotEmpty(def.PropRules.OfType <PropRuleString>().ToList()); var propRule = def.PropRules.OfType <PropRuleString>().First(); Assert.AreEqual(3, propRule.MinLength); Assert.AreEqual(7, propRule.MaxLength); //---------------Execute Test ---------------------- var validPropValue = factory.GetValidPropValue(typeof(FakeBO), "CompulsoryString").ToString(); //---------------Test Result ----------------------- Assert.IsNotNull(validPropValue); Assert.GreaterOrEqual(validPropValue.Length, 3); Assert.LessOrEqual(validPropValue.Length, 7); string errMessage = ""; Assert.IsTrue(def.IsValueValid(validPropValue, ref errMessage)); }
public bool equals(Object o) { ClassKey key = (ClassKey)o; ClassDef aDef = _defRef.get(); ClassDef bDef = key._defRef.get(); if (aDef != bDef) { return(false); } if (_parentRef == key._parentRef) { return(true); } else if (_parentRef != null && key._parentRef != null) { return(_parentRef.get() == key._parentRef.get()); } else { return(false); } }
///<summary> /// Constructor for the <see cref="BOSelectorAndBOEditorControlWin"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="classDef"></param> ///<param name="uiDefName"></param> ///<exception cref="ArgumentNullException"></exception> public BOSelectorAndBOEditorControlWin(IControlFactory controlFactory, ClassDef classDef, string uiDefName) { if (controlFactory == null) throw new ArgumentNullException("controlFactory"); if (classDef == null) throw new ArgumentNullException("classDef"); _classDef = classDef; BOEditorControl boEditorControl = new BOEditorControl(controlFactory, classDef, uiDefName); SetupGridAndBOEditorControlWin(controlFactory, boEditorControl, uiDefName); }
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(); 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; }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = CreateBOPropDef(); var keysCol = new KeyDefCol(); var primaryKey = new PrimaryKeyDef { IsGuidObjectID = false }; primaryKey.Add(lPropDefCol[PK1_PROP1_NAME]); var relDefs = new RelationshipDefCol(); var lClassDef = new ClassDef(typeof(BOWithCompositePK), primaryKey, lPropDefCol, keysCol, relDefs); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
private static ClassDef CreateClassDef() { PropDefCol propDefCol = CreateBOPropDef(); KeyDefCol keysCol = new KeyDefCol(); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(propDefCol["AddressID"]); RelationshipDefCol relDefCol = CreateRelationshipDefCol(propDefCol); ClassDef classDef = new ClassDef(typeof (Address), primaryKey, "contact_person_address", propDefCol, keysCol, relDefCol); ClassDef.ClassDefs.Add(classDef); return classDef; }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = CreateBOPropDef(); KeyDefCol keysCol = new KeyDefCol(); PrimaryKeyDef primaryKey = new PrimaryKeyDef {IsGuidObjectID = false}; primaryKey.Add(lPropDefCol[PK1_PROP1_NAME]); primaryKey.Add(lPropDefCol[PK1_PROP2_NAME]); RelationshipDefCol relDefs = CreateRelationshipDefCol(lPropDefCol); ClassDef lClassDef = new ClassDef(typeof (ContactPersonCompositeKey), primaryKey, lPropDefCol, keysCol, relDefs); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = CreateBOPropDef(); KeyDefCol keysCol = new KeyDefCol(); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["CarID"]); RelationshipDefCol relDefCol = CreateRelationshipDefCol(lPropDefCol); ClassDef lClassDef = new ClassDef(typeof (Car), primaryKey, "car_table", lPropDefCol, keysCol, relDefCol); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
public void Test_GetSuperClassClassDef() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); ClassDefCol classDefCol = new ClassDefCol(); ClassDef classDef = new ClassDef("Habanero.Test.BO", "UnknownClass", null, null, null, null, null); classDefCol.Add(classDef); SuperClassDef superClassDef = new SuperClassDef(classDef.AssemblyName, classDef.ClassName, ORMapping.ClassTableInheritance, null, null); //---------------Assert Precondition---------------- Assert.AreEqual(0, ClassDef.ClassDefs.Count); Assert.AreEqual(1, classDefCol.Count); //---------------Execute Test ---------------------- IClassDef def = ClassDefHelper.GetSuperClassClassDef(superClassDef, classDefCol); //---------------Test Result ----------------------- Assert.IsNotNull(def); Assert.AreSame(classDef, def); }
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 PropDefParameterSQLInfo(PropDef propDef, ClassDef classDef, string tableName, string parameterName) { _propDef = propDef; _classDef = classDef; _parameterName = parameterName; if (String.IsNullOrEmpty(_parameterName)) { _parameterName = _propDef.PropertyName; } if (_classDef != null) { _tableName = classDef.TableName; } else { _tableName = tableName; } }
public override Null Visit(ClassDef node) { // Define the class node.symbol = new Symbol { kind = SymbolKind.Class, isStatic = true, def = node, type = new MetaType { instanceType = new ClassType { def = node } } }; scope.Define(node.symbol); // Make a class scope node.block.scope = new Scope(scope, log, ScopeKind.Class); base.Visit(node); return null; }
private static ClassDef CreateClassDef() { PropDefCol lPropDefCol = CreateBOPropDef(); KeyDefCol keysCol = new KeyDefCol(); PrimaryKeyDef primaryKey = new PrimaryKeyDef(); primaryKey.IsGuidObjectID = true; primaryKey.Add(lPropDefCol["EngineID"]); RelationshipDefCol relDefCol = CreateRelationshipDefCol(lPropDefCol); ClassDef lClassDef = new ClassDef(typeof (Engine), primaryKey, lPropDefCol, keysCol, relDefCol); lClassDef.TableName = "Table_Engine"; ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
public void TestAddDuplicateException() { //---------------Set up test pack------------------- ClassDef classDef1 = new ClassDef("ass", "class", null, null, null, null, null); ClassDef classDef2 = new ClassDef("ass", "class", null, null, null, null, null); ClassDefCol col = new ClassDefCol(); col.Add(classDef1); //---------------Execute Test ---------------------- try { col.Add(classDef2); Assert.Fail("Expected to throw an HabaneroDeveloperException"); } //---------------Test Result ----------------------- catch (HabaneroDeveloperException ex) { StringAssert.Contains("A duplicate class element has been encountered", ex.Message); } }
private void AddDiscriminatorProperties(ClassDef classDef, IBOPropCol propsToInclude, IBOPropCol discriminatorProps) { ClassDef classDefWithSTI = null; if (classDef.IsUsingSingleTableInheritance() || classDefWithSTI != null) { string discriminator = null; if (classDef.SuperClassDef != null) { discriminator = classDef.SuperClassDef.Discriminator; } else if (classDefWithSTI != null) { discriminator = classDefWithSTI.SuperClassDef.Discriminator; } if (discriminator == null) { throw new InvalidXmlDefinitionException("A super class has been defined " + "using Single Table Inheritance, but no discriminator column has been set."); } if (propsToInclude.Contains(discriminator) && _bo.Props.Contains(discriminator)) { var boProp = _bo.Props[discriminator]; boProp.Value = _bo.ClassDef.ClassName; } else if (!discriminatorProps.Contains(discriminator)) { var propDef = new PropDef(discriminator, typeof (string), PropReadWriteRule.ReadWrite, null); var discriminatorProp = new BOProp(propDef, _bo.ClassDef.ClassName); discriminatorProps.Add(discriminatorProp); } } if (classDef.IsUsingSingleTableInheritance()) { IClassDef superClassClassDef = classDef.SuperClassClassDef; AddDiscriminatorProperties((ClassDef) superClassClassDef, propsToInclude, discriminatorProps); } }
internal static stmt Convert(Statement stmt) { stmt ast; if (stmt is FunctionDefinition) ast = new FunctionDef((FunctionDefinition)stmt); else if (stmt is ReturnStatement) ast = new Return((ReturnStatement)stmt); else if (stmt is AssignmentStatement) ast = new Assign((AssignmentStatement)stmt); else if (stmt is AugmentedAssignStatement) ast = new AugAssign((AugmentedAssignStatement)stmt); else if (stmt is DelStatement) ast = new Delete((DelStatement)stmt); else if (stmt is PrintStatement) ast = new Print((PrintStatement)stmt); else if (stmt is ExpressionStatement) ast = new Expr((ExpressionStatement)stmt); else if (stmt is ForStatement) ast = new For((ForStatement)stmt); else if (stmt is WhileStatement) ast = new While((WhileStatement)stmt); else if (stmt is IfStatement) ast = new If((IfStatement)stmt); else if (stmt is WithStatement) ast = new With((WithStatement)stmt); else if (stmt is RaiseStatement) ast = new Raise((RaiseStatement)stmt); else if (stmt is TryStatement) ast = Convert((TryStatement)stmt); else if (stmt is AssertStatement) ast = new Assert((AssertStatement)stmt); else if (stmt is ImportStatement) ast = new Import((ImportStatement)stmt); else if (stmt is FromImportStatement) ast = new ImportFrom((FromImportStatement)stmt); else if (stmt is ExecStatement) ast = new Exec((ExecStatement)stmt); else if (stmt is GlobalStatement) ast = new Global((GlobalStatement)stmt); else if (stmt is ClassDefinition) ast = new ClassDef((ClassDefinition)stmt); else if (stmt is BreakStatement) ast = new Break(); else if (stmt is ContinueStatement) ast = new Continue(); else if (stmt is EmptyStatement) ast = new Pass(); else throw new ArgumentTypeException("Unexpected statement type: " + stmt.GetType()); ast.GetSourceLocation(stmt); return ast; }
public void VisitClass(ClassDef c) { var baseClasses = c.args.Select(a => GenerateBaseClassName(a)).ToList(); var comments = ConvertFirstStringToComments(c.body.stmts); var stmtXlt = new StatementTranslator(gen, new Dictionary<string, LocalSymbol>()); stmtXlt.currentClass = c; var csClass = gen.Class(c.name.Name, baseClasses, () => c.body.Accept(stmtXlt)); csClass.Comments.AddRange(comments); if (customAttrs != null) { csClass.CustomAttributes.AddRange(customAttrs); customAttrs = null; } }
public void Test_Add_WithSameClassDef_IgnoresAdd() { //---------------Set up test pack------------------- ClassDef classDef = new ClassDef (typeof(MockBo), new PrimaryKeyDef(), new PropDefCol(), new KeyDefCol(), new RelationshipDefCol()); ClassDefCol classDefCol = new ClassDefCol(); classDefCol.Add(classDef); //---------------Assert PreConditions--------------- Assert.AreEqual(1, classDefCol.Count); //---------------Execute Test ---------------------- classDefCol.Add(classDef); //---------------Test Result ----------------------- Assert.AreEqual(1, classDefCol.Count); }
public void TestRemove() { ClassDef classDef = new ClassDef(typeof (String), null, null, null, null, null, null); ClassDefCol col = new ClassDefCol(); col.Add(classDef); Assert.AreEqual(1, col.Count); col.Remove(classDef); Assert.AreEqual(0, col.Count); col.Add(classDef); Assert.AreEqual(1, col.Count); col.Remove(typeof (String)); Assert.AreEqual(0, col.Count); }
private IBusinessObject GetBusinessObjectStub() { PropDefCol propDefCol = new PropDefCol {_propDef_int}; PrimaryKeyDef def = new PrimaryKeyDef {_propDef_int}; def.IsGuidObjectID = false; ClassDef classDef = new ClassDef(typeof (BusinessObjectStub), def, propDefCol, new KeyDefCol(), null); BusinessObjectStub businessObjectStub = new BusinessObjectStub(classDef); BOProp prop = new BOPropLookupList(_propDef_int); businessObjectStub.Props.Remove(prop.PropertyName); businessObjectStub.Props.Add(prop); return businessObjectStub; }
public void VisitClass(ClassDef c) { throw new NotImplementedException(); }
private IUIGrid GetGridDef(ClassDef classDef, string uiDefName) { IUIDef uiDef = classDef.GetUIDef(uiDefName); if (uiDef == null) { throw new ArgumentException (String.Format ("You cannot initialise {0} because it does not contain a definition for UIDef {1} for the class def {2}", this.Grid.Grid.Name, uiDefName, classDef.ClassName)); } IUIGrid gridDef = uiDef.UIGrid; if (gridDef == null) { throw new ArgumentException (String.Format ("You cannot initialise {0} does not contain a grid definition for UIDef {1} for the class def {2}", this.Grid.Grid.Name, uiDefName, classDef.ClassName)); } return gridDef; }
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 ClassDef CreateClassDef() { PropDefCol lPropDefCol = new PropDefCol(); KeyDefCol keysCol = new KeyDefCol(); RelationshipDefCol relDefCol = new RelationshipDefCol(); //ClassDef lClassDef = new ClassDef(typeof(FilledCircleInheritsCircleNoPK), primaryKey, lPropDefCol, keysCol, relDefCol); ClassDef lClassDef = new ClassDef(typeof(FakeSubClass), null, lPropDefCol, keysCol, relDefCol, null); lClassDef.SuperClassDef = new SuperClassDef(FakeSuperClass.GetClassDef(), ORMapping.SingleTableInheritance); ClassDef.ClassDefs.Add(lClassDef); return lClassDef; }
public void TestIndexer_Get() { //---------------Set up test pack------------------- ClassDef classDef = new ClassDef (typeof (MockBo), new PrimaryKeyDef(), new PropDefCol(), new KeyDefCol(), new RelationshipDefCol()); ClassDefCol col = new ClassDefCol(); col.Add(classDef); //---------------Assert Preconditions -------------- //---------------Execute Test ---------------------- IClassDef returnedClassDef = col[typeof (MockBo)]; //---------------Test Result ----------------------- Assert.AreEqual(classDef, returnedClassDef); }