Ejemplo n.º 1
0
        public static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""AddressTestBO"" assembly=""Habanero.Test.BO"" table=""contact_person_address"">
					<property name=""AddressID"" type=""Guid"" />
                    <property name=""ContactPersonID"" type=""Guid"" />
					<property name=""OrganisationID"" type=""Guid""  />
                    <property name=""AddressLine1""  />
					<property name=""AddressLine2""  />
					<property name=""AddressLine3""  />
					<property name=""AddressLine4""  />
					<primaryKey>
						<prop name=""AddressID"" />
					</primaryKey>
                    <relationship name=""ContactPersonTestBO"" type=""single"" relatedClass=""ContactPersonTestBO"" relatedAssembly=""Habanero.Test.BO"" reverseRelationship=""Addresses"">
						<relatedProperty property=""ContactPersonID"" relatedProperty=""ContactPersonID"" />
					</relationship>
                    <ui>
						<grid>
							<column heading=""AddressLine1"" property=""AddressLine1"" type=""DataGridViewTextBoxColumn"" />
							<column heading=""AddressLine2"" property=""AddressLine2"" type=""DataGridViewTextBoxColumn"" />
							<column heading=""AddressLine3"" property=""AddressLine3"" type=""DataGridViewTextBoxColumn"" />
							<column heading=""AddressLine4"" property=""AddressLine4"" type=""DataGridViewTextBoxColumn"" />
						</grid>
					</ui>
			    </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;

        }
Ejemplo n.º 2
0
	    public static IClassDef LoadDefaultClassDef()
		{
			XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
			IClassDef classDef = itsLoader.LoadClass(@"
				<class name=""OrderItem"" assembly=""Habanero.Test"">
					<property name=""OrderNumber"" type=""int"" compulsory=""true"" />
					<property name=""Product"" compulsory=""true"" />
					<primaryKey isObjectID=""false"" >
						<prop name=""OrderNumber"" />
						<prop name=""Product"" />
					</primaryKey>
					<ui>
						<grid>
							<column property=""OrderNumber"" />
							<column property=""Product"" />
						</grid>
						<form>
							<field property=""OrderNumber"" />
							<field property=""Product"" />
						</form>
					</ui>
				</class>
			");
			ClassDef.ClassDefs.Add(classDef);
			return classDef;
		}
Ejemplo n.º 3
0
        public static ClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader();
            ClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""OrganisationTestBO"" assembly=""Habanero.Test.BO"" table=""organisation"">
					<property  name=""OrganisationID"" type=""Guid"" />
                    <property name=""Name"" />
					<primaryKey>
						<prop name=""OrganisationID"" />
					</primaryKey>
					<relationship name=""ContactPeople"" type=""multiple"" relatedClass=""ContactPersonTestBO"" relatedAssembly=""Habanero.Test.BO"" deleteAction=""DeleteRelated"">
						<relatedProperty property=""OrganisationID"" relatedProperty=""OrganisationID"" />
					</relationship>
                    <ui>
                        <grid>
                            <column heading=""OrganisationID"" property=""OrganisationID"" />
                        </grid>
                        <form>
                            <field label=""OrganisationID: *"" property=""OrganisationID"" />
                        </form>
                    </ui>
			    </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Loads the class definition data from the reader
 /// </summary>
 protected override void LoadFromReader()
 {
     _classDefList = _defClassFactory.CreateClassDefCol();
     //_classDefList = new ArrayList();
     _reader.Read();
     _reader.Read();
     do
     {
         try
         {
             XmlClassLoader classLoader = new XmlClassLoader(DtdLoader, _defClassFactory);
             var            classDefCol = classLoader.LoadClass(_reader.ReadOuterXml());
             if (classDefCol != null)
             {
                 _classDefList.Add(classDefCol);
             }
         }
         catch (Exception ex)
         {
             //This is a RecordingExceptionNotifiere so it will log this error and
             // allow the continued processing of this XMLFile.
             GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
         }
     } while (_reader.Name == "class");
 }
Ejemplo n.º 5
0
        public static IClassDef LoadClassDefWithIntID_RelationshipToSelf()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""BOWithIntID"" assembly=""Habanero.Test.BO"" table=""bowithintid"" >
					<property  name=""IntID"" type=""Int32"" />
					<property  name=""ChildIntID"" type=""Int32"" />
					<property  name=""TestField"" default=""testing"" />
					<primaryKey isObjectID=""false"">
						<prop name=""IntID"" />
					</primaryKey>
					<relationship name=""MyChildBoWithInt"" type=""single"" relatedClass=""BOWithIntID"" 
                        relatedAssembly=""Habanero.Test.BO"" deleteAction=""DeleteRelated"" owningBOHasForeignKey=""true""
                        reverseRelationship=""MyParentBOWithInt"">
						<relatedProperty property=""ChildIntID"" relatedProperty=""IntID"" />
					</relationship>
                    <relationship name=""MyParentBOWithInt"" type=""single"" relatedClass=""BOWithIntID"" 
                        relatedAssembly=""Habanero.Test.BO"" deleteAction=""DeleteRelated"" owningBOHasForeignKey=""false""
                        reverseRelationship=""MyChildBoWithInt"">
						<relatedProperty property=""IntID"" relatedProperty=""ChildIntID"" />
					</relationship>
				</class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Load ClassDef for accessing the transacionLog table through Business Object.
        /// </summary>
        public static IClassDef LoadClassDef()
        {
            if (ClassDef.ClassDefs.Contains(typeof(TransactionLogBusObj)))
            {
                return ClassDef.ClassDefs[typeof(TransactionLogBusObj)];
            }
            XmlClassLoader xmlClassLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef classDef =
                xmlClassLoader.LoadClass(
                    @"
               <class name=""TransactionLogBusObj"" assembly=""Habanero.BO"" table=""transactionlog"">
					<property  name=""TransactionSequenceNo"" type=""Int32"" autoIncrementing=""true"" />
					<property  name=""DateTimeUpdated"" type=""DateTime"" />
					<property  name=""WindowsUser""/>
					<property  name=""LogonUser"" />
					<property  name=""MachineUpdatedName"" databaseField=""MachineName""/>
					<property  name=""BusinessObjectTypeName"" />
                    <property  name=""BusinessObjectToString""/>
					<property  name=""CRUDAction"" />
					<property  name=""DirtyXMLLog"" databaseField=""DirtyXML""/>
					<primaryKey isObjectID=""false"">
						<prop name=""TransactionSequenceNo"" />
					</primaryKey>
			    </class>
			");
            ClassDef.ClassDefs.Add(classDef);
            return classDef;
        }
Ejemplo n.º 7
0
        public static IClassDef LoadDefaultClassDef_WithCircularDeleteRelatedToSelf()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""Entity"" assembly=""Habanero.Test.Structure"" table=""table_Entity"">
			    <property name=""EntityID"" type=""Guid"" databaseField=""field_Entity_ID"" compulsory=""true"" />
			    <property name=""RelatedEntityID"" type=""Guid"" databaseField=""field_Entity_Type"" />
                <primaryKey>
			      <prop name=""EntityID"" />
			    </primaryKey>
				<relationship name=""RelatedEntity"" type=""single"" relatedClass=""Entity"" relatedAssembly=""Habanero.Test.Structure"" 
                        owningBOHasForeignKey=""true"" reverseRelationship=""RelatedEntityReverse""
                        deleteAction=""DeleteRelated"">
					<relatedProperty property=""RelatedEntityID"" relatedProperty=""EntityID"" />
				</relationship>
				<relationship name=""RelatedEntityReverse"" type=""single"" relatedClass=""Entity"" relatedAssembly=""Habanero.Test.Structure"" 
                        owningBOHasForeignKey=""false"" reverseRelationship=""RelatedEntity""
                        deleteAction=""DoNothing"">
					<relatedProperty property=""EntityID"" relatedProperty=""RelatedEntityID"" />
				</relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 8
0
        public static IClassDef CreateClassDefWithTwoPropsOneCompulsory()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""Sample"" assembly=""Habanero.Test"">
					<property  name=""SampleID"" type=""Guid"" />
					<property  name=""SampleText"" />
					<property  name=""SampleText2"" compulsory=""true""/>
					<primaryKey>
						<prop name=""SampleID"" />
					</primaryKey>
					<ui>
						<form>
							<tab name=""Tab1"">
								<columnLayout width=""150"">
									<field label=""CompulsorySampleText:"" property=""SampleText2"" type=""TextBox"" mapperType=""TextBoxMapper"" />
									<field label=""SampleTextNotCompulsory:"" property=""SampleText"" type=""TextBox"" mapperType=""TextBoxMapper"" />
								</columnLayout>
							</tab>
						</form>
					</ui>
				</class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 9
0
        public static IClassDef LoadClassDef_WithSingleTableInheritance()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""LegalEntity"" assembly=""Habanero.Test.Structure"" table=""table_class_LegalEntity"">
			    <superClass class=""Entity"" assembly=""Habanero.Test.Structure"" orMapping=""SingleTableInheritance"" discriminator=""EntityType"" />
			    <property name=""LegalEntityType"" databaseField=""field_Legal_Entity_Type"" />
			    <relationship name=""VehiclesOwned"" type=""multiple"" relatedClass=""Vehicle"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""EntityID"" relatedProperty=""OwnerID"" />
			    </relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 10
0
        public static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""Entity"" assembly=""Habanero.Test.Structure"" table=""table_Entity"">
			    <property name=""EntityID"" type=""Guid"" databaseField=""field_Entity_ID"" compulsory=""true"" />
			    <property name=""EntityType"" databaseField=""field_Entity_Type"" />
			    <primaryKey>
			      <prop name=""EntityID"" />
			    </primaryKey>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 11
0
        public TestValueObject()
        {
            ClassDef.ClassDefs.Clear();
            XmlClassLoader loader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            _itsClassDef = loader.LoadClass
                (@"
				<class name=""MyBO"" assembly=""Habanero.Test"">
					<property  name=""MyBoID"" type=""Guid"" />
					<property  name=""TestProp"" type=""Habanero.Test.Util.SimpleValueObjectStub"" assembly=""Habanero.Test"" />
					<primaryKey>
						<prop name=""MyBoID"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(_itsClassDef);
        }
Ejemplo n.º 12
0
        public void SetupFixture()
        {
            TestUsingDatabase.SetupDBDataAccessor();
            ClassDef.ClassDefs.Clear();
            XmlClassLoader loader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            _itsClassDef = loader.LoadClass
                (@"
				<class name=""MyBO"" assembly=""Habanero.Test"">
					<property  name=""MyBoID"" type=""Guid"" />
					<property  name=""TestProp"" type=""Habanero.Util.LongText"" assembly=""Habanero.Base"" />
					<primaryKey>
						<prop name=""MyBoID"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(_itsClassDef);
        }
Ejemplo n.º 13
0
        public static IClassDef LoadClassDefWithAutoIncrementingID()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""TestAutoInc"" assembly=""Habanero.Test"" table=""testautoinc"" >
					<property  name=""testautoincid"" type=""Int32"" autoIncrementing=""true"" />
					<property  name=""testfield"" default=""testing"" />
					<primaryKey isObjectID=""false"">
						<prop name=""testautoincid"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 14
0
        public static IClassDef LoadClassDef_WithClassTableInheritance()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""Part"" assembly=""Habanero.Test.Structure"" table=""table_class_Part"">
			    <superClass class=""Entity"" assembly=""Habanero.Test.Structure"" id=""PartID"" />
			    <property name=""PartID"" type=""Guid"" databaseField=""field_Part_ID"" compulsory=""true"" />
			    <property name=""ModelNo"" databaseField=""field_Model_No"" />
			    <property name=""PartType"" databaseField=""field_Part_Type"" />
			    <primaryKey>
			      <prop name=""PartID"" />
			    </primaryKey>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
        public static IClassDef LoadClassDefWithIntID()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""BOWithIntID_DifferentType"" assembly=""Habanero.Test.BO"" table=""bowithintid"" >
					<property  name=""IntID"" type=""Int32"" />
					<property  name=""TestField"" default=""testing"" />
					<primaryKey isObjectID=""false"">
						<prop name=""IntID"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 16
0
        public TestLongText()
        {
            ClassDef.ClassDefs.Clear();
            XmlClassLoader loader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            _itsClassDef = loader.LoadClass
                (@"
				<class name=""MyBO"" assembly=""Habanero.Test"">
					<property  name=""MyBoID"" type=""Guid"" />
					<property  name=""TestProp"" type=""Habanero.Util.LongText"" assembly=""Habanero.Base"" />
					<primaryKey>
						<prop name=""MyBoID"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(_itsClassDef);
            base.SetupDBConnection();
        }
Ejemplo n.º 17
0
        public new static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""LegalEntity"" assembly=""Habanero.Test.Structure"" table=""table_LegalEntity"">
			    <property name=""LegalEntityID"" type=""Guid"" databaseField=""field_Legal_Entity_ID"" />
			    <property name=""LegalEntityType"" databaseField=""field_Legal_Entity_Type"" />
			    <primaryKey>
			      <prop name=""LegalEntityID"" />
			    </primaryKey>
			    <relationship name=""VehiclesOwned"" type=""multiple"" relatedClass=""Vehicle"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""LegalEntityID"" relatedProperty=""OwnerID"" />
			    </relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 18
0
        public new static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""Organisation"" assembly=""Habanero.Test.Structure"" table=""table_Organisation"">
			    <property name=""Name"" databaseField=""field_Name"" />
			    <property name=""DateFormed"" databaseField=""field_Date_Formed"" />
			    <property name=""OrganisationID"" type=""Guid"" databaseField=""field_Organisation_ID"" compulsory=""true"" />
			    <primaryKey>
			      <prop name=""OrganisationID"" />
			    </primaryKey>
			    <relationship name=""OrganisationPerson"" type=""multiple"" relatedClass=""OrganisationPerson"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""OrganisationID"" relatedProperty=""OrganisatiionID"" />
			    </relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 19
0
		public TestByteString()
		{
			ClassDef.ClassDefs.Clear();
			var loader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
			_classDef =
				loader.LoadClass(
					@"
				<class name=""MyBO"" assembly=""Habanero.Test"">
					<property  name=""MyBoID"" type=""Guid"" />
					<property  name=""TestProp"" type=""Habanero.Util.ByteString"" assembly=""Habanero.Base"" />
					<property  name=""ByteArrayProp"" type=""Byte[]"" />
					<primaryKey>
						<prop name=""MyBoID"" />
					</primaryKey>
				</class>
			");
			ClassDef.ClassDefs.Add(_classDef);
			base.SetupDBConnection();
		}
Ejemplo n.º 20
0
        public static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""BeforeSaveBo"" assembly=""Habanero.Test"" >
					<property name=""BeforeSaveBoId"" type=""Guid"" />
					<property name=""FirstPart"" />
					<property name=""SecondPart"" />
					<property name=""CombinedParts"" />
					<primaryKey>
						<prop name=""BeforeSaveBoId"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 21
0
        public static ClassDef LoadDefaultClassDef_WithSingleRelationship()
        {
            XmlClassLoader itsLoader = new XmlClassLoader();
            ClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""OrganisationTestBO"" assembly=""Habanero.Test.BO"" table=""organisation"">
					<property  name=""OrganisationID"" type=""Guid"" />
                    <property name=""Name"" />
					<primaryKey>
						<prop name=""OrganisationID"" />
					</primaryKey>
					<relationship name=""ContactPerson"" type=""single"" relatedClass=""ContactPersonTestBO"" relatedAssembly=""Habanero.Test.BO"" deleteAction=""DeleteRelated"">
						<relatedProperty property=""OrganisationID"" relatedProperty=""OrganisationID"" />
					</relationship>
			    </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 22
0
        private static IClassDef LoadClassDef_WithInheritance(ORMapping orMapping)
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(String.Format(@"
			  <class name=""Vehicle"" assembly=""Habanero.Test.Structure"" table=""table_class_Vehicle"">
			    <superClass class=""Entity"" assembly=""Habanero.Test.Structure"" orMapping=""{0}"" {1} />
			    <property name=""VehicleID"" type=""Guid"" databaseField=""field_Vehicle_ID"" />
			    <property name=""VehicleType"" databaseField=""field_Vehicle_Type"" />
			    <property name=""DateAssembled"" type=""DateTime"" databaseField=""field_Date_Assembled"" />
			    <property name=""OwnerID"" type=""Guid"" databaseField=""field_Owner_ID"" />
			    <primaryKey>
			      <prop name=""VehicleID"" />
			    </primaryKey>
			    <relationship name=""Owner"" type=""single"" relatedClass=""LegalEntity"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""OwnerID"" relatedProperty=""LegalEntityID"" />
			    </relationship>
			  </class>
			", Enum.GetName(typeof(ORMapping), orMapping), orMapping == ORMapping.SingleTableInheritance ? "discriminator=\"EntityType\"" : ""));
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 23
0
        public static IClassDef LoadClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            _newClassDef = itsLoader.LoadClass(@"
			<class name=""MultiPropBO"" assembly=""Habanero.Test"">
                <property name=""MultiPropBOID"" type=""Guid"" />
                <property name=""DateTimeProp"" type=""DateTime"" />
				<property name=""StringProp"" />
                <property name=""IntProp"" type=""int"" />
				<property name=""GuidProp"" type=""Guid"" />
                <property name=""DoubleProp"" type=""double"" />
                <property name=""SingleProp"" type=""Single"" />
                <property name=""TimeSpanProp"" type=""TimeSpan"" />
				<primaryKey>
					<prop name=""MultiPropBOID"" />
				</primaryKey>
			</class>
		    ");
            ClassDef.ClassDefs.Add(_newClassDef);
            return _newClassDef;
        }
Ejemplo n.º 24
0
        public new static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""Car"" assembly=""Habanero.Test.Structure"" table=""table_Car"">
			    <property name=""CarID"" type=""Guid"" databaseField=""field_Car_ID"" />
			    <property name=""RegistrationNo"" databaseField=""field_Registration_No"" />
			    <property name=""Length"" type=""Double"" databaseField=""field_Length"" />
			    <property name=""IsConvertible"" type=""Boolean"" databaseField=""field_Is_Convertible"" />
			    <property name=""DriverID"" type=""Guid"" databaseField=""field_Driver_ID"" />
			    <primaryKey>
			      <prop name=""CarID"" />
			    </primaryKey>
			    <relationship name=""Driver"" type=""single"" relatedClass=""Person"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""DriverID"" relatedProperty=""PersonID"" />
			    </relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 25
0
        public new static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""Engine"" assembly=""Habanero.Test.Structure"" table=""table_Engine"">
			    <property name=""EngineID"" type=""Guid"" databaseField=""field_Engine_ID"" compulsory=""true"" />
			    <property name=""EngineNo"" databaseField=""field_Engine_No"" />
			    <property name=""DateManufactured"" type=""DateTime"" databaseField=""field_Date_Manufactured"" />
			    <property name=""HorsePower"" type=""Int32"" databaseField=""field_Horse_Power"" />
			    <property name=""FuelInjected"" type=""Boolean"" databaseField=""field_Fuel_Injected"" />
			    <property name=""CarID"" type=""Guid"" databaseField=""field_Car_ID"" />
			    <primaryKey>
			      <prop name=""EngineID"" />
			    </primaryKey>
			    <relationship name=""Car"" type=""single"" relatedClass=""Car"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""CarID"" relatedProperty=""CarID"" />
			    </relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 26
0
        public static IClassDef LoadDefaultClassDef()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""OrganisationPerson"" assembly=""Habanero.Test.Structure"" table=""table_OrganisationPerson"">
			    <property name=""OrganisatiionID"" type=""Guid"" databaseField=""field_Organisatiion_ID"" />
			    <property name=""PersonID"" type=""Guid"" databaseField=""field_Person_ID"" />
			    <property name=""Relationship"" databaseField=""field_Relationship"" />
			    <primaryKey isObjectID=""false"">
			      <prop name=""OrganisatiionID"" />
			      <prop name=""PersonID"" />
			    </primaryKey>
			    <relationship name=""Organisation"" type=""single"" relatedClass=""Organisation"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""OrganisatiionID"" relatedProperty=""OrganisationID"" />
			    </relationship>
			    <relationship name=""Person"" type=""single"" relatedClass=""Person"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""PersonID"" relatedProperty=""PersonID"" />
			    </relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 27
0
        public static ClassDef LoadDefaultClassDef_PreventAddChild()
        {
            XmlClassLoader itsLoader = new XmlClassLoader();
            ClassDef itsClassDef =
                itsLoader.LoadClass(
                    @"
				<class name=""OrganisationTestBO"" assembly=""Habanero.Test.BO"" table=""organisation"">
					<property  name=""OrganisationID"" type=""Guid"" />
                    <property name=""Name"" />
					<primaryKey>
						<prop name=""OrganisationID"" />
					</primaryKey>
			    </class>
			");
            RelPropDef relPropDef = new RelPropDef(itsClassDef.PropDefcol["OrganisationID"], "OrganisationID");
            RelKeyDef relKeyDef = new RelKeyDef();
            relKeyDef.Add(relPropDef);
            MultipleRelationshipDef relationshipDef = new MultipleRelationshipDef("ContactPeople", "Habanero.Test.BO",
                    "ContactPersonTestBO", relKeyDef, true, "", DeleteParentAction.DeleteRelated
                    , RelationshipType.Composition);
            itsClassDef.RelationshipDefCol.Add(relationshipDef);
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
Ejemplo n.º 28
0
        public new static IClassDef LoadClassDef_WithClassTableInheritance()
        {
            XmlClassLoader itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            IClassDef itsClassDef = itsLoader.LoadClass(@"
			  <class name=""Person"" assembly=""Habanero.Test.Structure"" table=""table_class_Person"">
			    <superClass class=""LegalEntity"" assembly=""Habanero.Test.Structure"" />
			    <property name=""IDNumber"" databaseField=""field_ID_Number"" />
			    <property name=""FirstName"" databaseField=""field_First_Name"" />
			    <property name=""LastName"" databaseField=""field_Last_Name"" />
			    <property name=""PersonID"" type=""System.Guid"" databaseField=""field_Person_ID"" compulsory=""true"" />
			    <primaryKey>
			      <prop name=""PersonID"" />
			    </primaryKey>
			    <relationship name=""CarsDriven"" type=""multiple"" relatedClass=""Car"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""PersonID"" relatedProperty=""DriverID"" />
			    </relationship>
			    <relationship name=""OrganisationPerson"" type=""multiple"" relatedClass=""OrganisationPerson"" relatedAssembly=""Habanero.Test.Structure"">
			      <relatedProperty property=""PersonID"" relatedProperty=""PersonID"" />
			    </relationship>
			  </class>
			");
            ClassDef.ClassDefs.Add(itsClassDef);
            return itsClassDef;
        }
        internal static void LoadNumberGenClassDef()
		{
			var itsLoader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
			var itsClassDef =
				itsLoader.LoadClass(
					@"
			   <class name=""BOSequenceNumberLocking"" assembly=""Habanero.DB"" table=""NumberGenerator"">
					<property  name=""SequenceNumber"" type=""Int64"" />
					<property  name=""NumberType""/>
					<property  name=""DateTimeLocked"" type=""DateTime"" />
					<property  name=""UserLocked"" />
					<property  name=""Locked"" type=""Boolean""/>
					<property  name=""MachineLocked"" />
					<property  name=""OperatingSystemUserLocked"" />
					<primaryKey isObjectID=""false"">
						<prop name=""NumberType"" />
					</primaryKey>
				</class>
			");
			ClassDef.ClassDefs.Add(itsClassDef);
			return;
		}
        public void Test_WithTimeout()
        {
            //---------------Set up test pack-------------------
            XmlClassLoader loader = new XmlClassLoader(new DtdLoader(), GetDefClassFactory());
            IClassDef personClassDef =
                loader.LoadClass(
                    @"
				<class name=""ContactPersonTestBO"" assembly=""Habanero.Test.BO"" table=""contact_person"">
					<property name=""ContactPersonID"" type=""Guid"" />
					<property name=""Surname"" databaseField=""Surname_field"" compulsory=""true"" />
                    <property name=""FirstName"" databaseField=""FirstName_field"" />
					<property name=""DateOfBirth"" type=""DateTime"" />
					<primaryKey>
						<prop name=""ContactPersonID"" />
					</primaryKey>
			    </class>
			");
            ClassDef.ClassDefs.Add(personClassDef);


            const string relXml = @"
					<relationship 
						name=""TestRelationship"" 
						type=""multiple"" 
                        relatedClass=""ContactPersonTestBO"" 
						relatedAssembly=""Habanero.Test.BO""
                        timeout=""2000""
                    >
						    <relatedProperty property=""TestProp"" relatedProperty=""TestRelatedProp"" />
					</relationship>";
            //---------------Assert PreConditions---------------   
            //---------------Execute Test ----------------------

            IRelationshipDef relDef = _loader.LoadRelationship(relXml, _propDefs);
            //---------------Test Result -----------------------

            Assert.AreEqual(personClassDef.ClassName, relDef.RelatedObjectClassName);
            Assert.AreEqual(personClassDef.AssemblyName, relDef.RelatedObjectAssemblyName);
            Assert.AreEqual(2000, relDef.TimeOut );
            //---------------Tear Down -------------------------          
        }
		public void PersistSQLparamaterValue_WhenByteArrayNull_WhenSQLServer_ShouldNotExist_FIXBUG1741()
		{
			//---------------Set up test pack-------------------
			var loader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
			var classDef = loader.LoadClass(@"
					<class name=""MyBO"" assembly=""Habanero.Test"">
						<property  name=""MyBoID"" type=""Guid"" />
						<property  name=""ByteArrayProp"" type=""Byte[]"" />
						<primaryKey>
							<prop name=""MyBoID"" />
						</primaryKey>
					</class>
				");
            ClassDef.ClassDefs.Clear();
			ClassDef.ClassDefs.Add(classDef);
			var bo = classDef.CreateNewBusinessObject();
			bo.SetPropertyValue("ByteArrayProp", null);
			//---------------Assert Precondition----------------

			//---------------Execute Test ----------------------
			var sqlCol = new TransactionalBusinessObjectDB(bo, DatabaseConnection.CurrentConnection).GetPersistSql();
			var sqlStatement = sqlCol.First();
			//IList parameters = sqlStatement.Parameters;

			DatabaseConnection.CurrentConnection.ExecuteSql(sqlStatement);
			//---------------Test Result -----------------------
			Assert.Pass("If it got here then it is OK");
		}