You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(56) |
Nov
(13) |
Dec
(36) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(7) |
Feb
(55) |
Mar
(33) |
Apr
(71) |
May
(12) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Richard B. <rb...@us...> - 2005-04-11 00:31:58
|
Update of /cvsroot/jcframework/dotnet/Nunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv815/Nunit Added Files: App.config AssemblyInfo.vb AtomsFramework.xml Nunit_AtomsFramework.nunit Nunit_AtomsFramework.vbproj original db1.mdb Log Message: Name changes to bring class library into line with Microsoft naming standards. FxCop directory added Nunit tests moved into main repository --- NEW FILE: AssemblyInfo.vb --- Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes <Assembly: AssemblyTitle("")> <Assembly: AssemblyDescription("")> <Assembly: AssemblyCompany("")> <Assembly: AssemblyProduct("")> <Assembly: AssemblyCopyright("")> <Assembly: AssemblyTrademark("")> <Assembly: CLSCompliant(True)> 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("AA61D737-B103-4141-A82B-D94EB737FF6A")> ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: <Assembly: AssemblyVersion("1.0.*")> --- NEW FILE: Nunit_AtomsFramework.vbproj --- <VisualStudioProject> <VisualBasic ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{60C96393-CBF7-4F59-B43A-DA1D6608EEBD}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "Nunit_AtomsFramework" AssemblyOriginatorKeyFile = "" AssemblyOriginatorKeyMode = "None" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" OptionCompare = "Binary" OptionExplicit = "On" OptionStrict = "Off" RootNamespace = "NunitTests" StartupObject = "NunitTests.(None)" > <Config Name = "Debug" BaseAddress = "285212672" ConfigurationOverrideFile = "" DefineConstants = "" DefineDebug = "true" DefineTrace = "true" DebugSymbols = "true" IncrementalBuild = "true" Optimize = "false" OutputPath = "bin\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "1" /> <Config Name = "Release" BaseAddress = "285212672" ConfigurationOverrideFile = "" DefineConstants = "" DefineDebug = "false" DefineTrace = "true" DebugSymbols = "false" IncrementalBuild = "false" Optimize = "true" OutputPath = "bin\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "1" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" /> <Reference Name = "System.Data" AssemblyName = "System.Data" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" /> <Reference Name = "nunit.framework" AssemblyName = "nunit.framework" HintPath = "..\..\..\Program Files\NUnit 2.2\bin\nunit.framework.dll" AssemblyFolderKey = "hklm\dn\nunit.framework" /> <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll" /> <Reference Name = "System.Windows.Forms" AssemblyName = "System.Windows.Forms" HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll" /> <Reference Name = "Atoms.Framework" Project = "{8FFD05CF-E733-4D8E-BC0E-D9DD37B87384}" Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}" /> </References> <Imports> <Import Namespace = "Microsoft.VisualBasic" /> <Import Namespace = "System" /> <Import Namespace = "System.Collections" /> <Import Namespace = "System.Data" /> <Import Namespace = "System.Diagnostics" /> </Imports> </Build> <Files> <Include> <File RelPath = "App.config" BuildAction = "None" /> <File RelPath = "AssemblyInfo.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "AtomsFramework.xml" BuildAction = "Content" /> <File RelPath = "InheritedClasses\AtomsFrameworkTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\AutoIdClasses.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\AutoIdTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\CEmployee.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\CJob.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\CSharedClasses.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\CStudent.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\CTeam.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\CWorker.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\ManyToManyClasses_v2.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\ManyToManyTests_v2.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\MultiRetrieveTestClasses.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\MultiRetrieveTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\RetrieveCriteriaTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\SharedTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\SuperClassTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\TableA_B.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "InheritedClasses\tblAtoKClasses.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Interfaces\EmployeeInterfaceTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Interfaces\IEmployee.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Interfaces\IOptimistic.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Interfaces\ManyToManyClasses.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Interfaces\ManyToManyTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Interfaces\TimestampTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Interfaces\ValidatedEmployee.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "StandardClasses\LazyEmployee.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "StandardClasses\NonInheritedRetreiveCriteria.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "StandardClasses\NonInheritedTests.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "StandardClasses\NPEmployee.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "StandardClasses\NPJob.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "StandardClasses\NPTeam.vb" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </VisualBasic> </VisualStudioProject> --- NEW FILE: App.config --- <?xml version="1.0" encoding="utf-8" ?> <configuration> </configuration> --- NEW FILE: Nunit_AtomsFramework.nunit --- (This appears to be a binary file; contents omitted.) --- NEW FILE: original db1.mdb --- (This appears to be a binary file; contents omitted.) --- NEW FILE: AtomsFramework.xml --- <?xml version="1.0" ?> <map> <database name="MSA" provider="bin\AF_OLEDB.dll"> <parameter name="name" value=".\db1.mdb" /> <parameter name="user" value="anyuser" /> <parameter name="password" value="anypassword" /> <parameter name="OIDTable" value="OID"/> </database> <class name="SharedParent" table="SharedClasses" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary"/> <attribute name="CreatedDate" column="created" timestamp="true"/> <attribute name="ModifiedDate" column="modified" timestamp="true"/> <attribute name="Field1" column="field1" /> </class> <!-- Proper XML mapping here would be to not have the OIDValue attribute since it inherits from the parent class (for shared tables). It is here for testing only. --> <class name="SharedChild" table="SharedClasses" superclass="SharedParent" database="MSA" sharedtablefield="IType" sharedtablevalue="PLN" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="Field2" column="field2" /> </class> <class name="NPJob" table="NPJobs" database="MSA" namespace="NunitTests.StandardClasses"> <attribute name="Id" column="id" key="primary"/> <attribute name="Description" column="description"/> </class> <class name="NPEmployee" table="NPEmployee" database="MSA" namespace="NunitTests.StandardClasses"> <attribute name="Name" column="name" find="true" key="primary"/> <attribute name="ReportsToName" column="parentname" /> <attribute name="TeamName" column="teamname" /> <attribute name="Team" /> <attribute name="ReportsTo" /> <attribute name="Workers" /> </class> <class name="NPTeam" table="NPTeams" database="MSA" namespace="NunitTests.StandardClasses"> <attribute name="Name" column="teamname" find="true" key="primary"/> <attribute name="TeamLeaderName" column="teamleader" /> <attribute name="jobId" column="jobid" /> <attribute name="TeamLeader" /> <attribute name="Job" /> </class> <association fromClass="NunitTests.StandardClasses.NPEmployee" toClass="NunitTests.StandardClasses.NPEmployee" target="ReportsTo" cardinality="OneToOne" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="false" inverse="false"> <entry fromAttribute="ReportsToName" toAttribute="Name"/> </association> <association fromClass="NunitTests.StandardClasses.NPEmployee" toClass="NunitTests.StandardClasses.NPEmployee" target="Workers" cardinality="OneToMany" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="false" inverse="false"> <entry fromAttribute="Name" toAttribute="ReportsToName"/> </association> <association fromClass="NunitTests.StandardClasses.NPTeam" toClass="NunitTests.StandardClasses.NPEmployee" target="TeamLeader" cardinality="OneToOne" retrieveAutomatic="true" saveAutomatic="false" deleteAutomatic="false" inverse="false"> <entry fromAttribute="TeamLeaderName" toAttribute="Name"/> </association> <association fromClass="NunitTests.StandardClasses.NPTeam" toClass="NunitTests.StandardClasses.NPJob" target="Job" cardinality="OneToOne" retrieveAutomatic="true" saveAutomatic="false" deleteAutomatic="false" inverse="false"> <entry fromAttribute="jobId" toAttribute="Id"/> </association> <association fromClass="NunitTests.StandardClasses.NPTeam" toClass="NunitTests.StandardClasses.NPEmployee" target="Members" cardinality="OneToMany" retrieveAutomatic="true" saveAutomatic="false" deleteAutomatic="false" inverse="false"> <entry fromAttribute="Name" toAttribute="TeamName"/> </association> <class name="IEmployee" table="NPEmployee" database="MSA" factory="IEmployeeFactory" namespace="NunitTests.Interfaces"> <attribute name="Name" column="name" key="primary" find="true"/> <attribute name="ReportsToName" column="parentname" /> <attribute name="TeamName" column="teamname" /> <attribute name="Team" /> <attribute name="ReportsTo" /> <attribute name="Workers" /> </class> <association fromClass="NunitTests.Interfaces.IEmployee" toClass="NunitTests.Interfaces.IEmployee" target="ReportsTo" cardinality="OneToOne" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="false" inverse="false"> <entry fromAttribute="ReportsToName" toAttribute="Name"/> </association> <association fromClass="NunitTests.Interfaces.IEmployee" toClass="NunitTests.Interfaces.IEmployee" target="Workers" cardinality="OneToMany" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="false" inverse="false"> <entry fromAttribute="Name" toAttribute="ReportsToName"/> </association> <class name="mr1" table="mr1" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="id" column="id" key="primary"/> <attribute name="field1" column="field1" /> <attribute name="field2" column="field2" /> <attribute name="mr2_id" column="mr2_id" /> <attribute name="mr2" /> </class> <class name="mr2" table="mr2" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="id" column="id" key="primary"/> <attribute name="field1" column="field1" /> <attribute name="field2" column="field2" /> <attribute name="mr3_id" column="mr3_id" /> <attribute name="mr3" /> </class> <class name="mr3" table="mr3" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="id" column="id" key="primary"/> <attribute name="field1" column="field1" /> <attribute name="field2" column="field2" /> </class> <association fromClass="NunitTests.InheritedClasses.mr1" toClass="NunitTests.InheritedClasses.mr2" target="mr2" cardinality="OneToOne" retrieveAutomatic="false" saveAutomatic="true" deleteAutomatic="false" inverse="false" name="mr1tomr2"> <entry fromAttribute="mr2_id" toAttribute="id"/> </association> <association fromClass="NunitTests.InheritedClasses.mr2" toClass="NunitTests.InheritedClasses.mr3" target="mr3" cardinality="OneToOne" retrieveAutomatic="false" saveAutomatic="true" deleteAutomatic="false" inverse="false" name="mr2tomr3"> <entry fromAttribute="mr3_id" toAttribute="id"/> </association> <class name="TableA" table="tableA" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="Id" column="id" key="primary"/> <attribute name="field1" column="field1" /> <attribute name="TableBCollection" /> <attribute name="TableCCollection" /> </class> <class name="TableB" table="TableB" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="Id" column="id" key="primary"/> <attribute name="field1" column="field1" /> <attribute name="AId" column="a_id" /> <attribute name="TableA" /> <attribute name="TableDCollection" /> </class> <class name="TableC" table="TableC" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="Id" column="id" key="primary"/> <attribute name="field1" column="field1" /> <attribute name="AId" column="a_id" /> <attribute name="TableA" /> </class> <association fromClass="NunitTests.InheritedClasses.TableA" toClass="NunitTests.InheritedClasses.TableB" target="TableBCollection" cardinality="OneToMany" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="true" inverse="false" name="AtoB"> <entry fromAttribute="Id" toAttribute="AId"/> </association> <association fromClass="NunitTests.InheritedClasses.TableA" toClass="NunitTests.InheritedClasses.TableC" target="TableCCollection" cardinality="OneToMany" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="true" inverse="false" name="AtoC"> <entry fromAttribute="Id" toAttribute="AId"/> </association> <class name="A" table="tblA" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true"/> <attribute name="BCol" /> <attribute name="C" /> <attribute name="COID" column="cOID"/> </class> <class name="B" table="tblB" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true"/> <attribute name="Text" column="textCol"/> <attribute name="A" /> <attribute name="AOID" column="aOID"/> <attribute name="NCol" /> </class> <class name="C" table="tblC" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true"/> <attribute name="Text" column="textCol"/> </class> <class name="D" table="tblD" database="MSA" superclass="B" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true" /> <attribute name="Str" column="str"/> </class> <class name="E" table="tblE" database="MSA" superclass="B" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true"/> <attribute name="Str" column="str"/> </class> <class name="F" table="tblF" database="MSA" superclass="E" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true"/> <attribute name="I" column="i"/> </class> <class name="G" table="tblG" database="MSA" superclass="E" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true" /> <attribute name="I" column="i"/> <attribute name="M" /> <attribute name="MOID" column="mOID" /> </class> <class name="H" table="tblH" database="MSA" superclass="C" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true" /> <attribute name="Str" column="str"/> </class> <class name="I" table="tblI" database="MSA" superclass="C" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true" /> <attribute name="Str" column="str"/> </class> <class name="J" table="tblJ" database="MSA" superclass="H" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true" /> <attribute name="I" column="i"/> </class> <class name="K" table="tblK" database="MSA" superclass="H" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="Id" column="id" find="true" /> <attribute name="I" column="i"/> <attribute name="M"/> <attribute name="MOID" column="mOID"/> </class> <class name="M" table="tblM" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="I" column="i"/> </class> <class name="N" table="tblN" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="OIDValue" column="oid" key="primary" reference="OIDValue"/> <attribute name="CreatedDate" column="CreatedDate" timestamp="true"/> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true"/> <attribute name="I" column="i"/> <attribute name="B" /> <attribute name="BOID" column="bOID"/> </class> <association fromClass="NunitTests.InheritedClasses.A" toClass="NunitTests.InheritedClasses.B" cardinality="oneToMany" target="BCol" retrieveAutomatic="true" deleteAutomatic="true" saveAutomatic="true" inverse="false"> <entry fromAttribute="OIDValue" toAttribute="AOID"/> </association> <association fromClass="NunitTests.InheritedClasses.B" toClass="NunitTests.InheritedClasses.A" cardinality="oneToOne" target="A" retrieveAutomatic="true" deleteAutomatic="false" saveAutomatic="false" inverse="false"> <entry fromAttribute="AOID" toAttribute="OIDValue"/> </association> <association fromClass="NunitTests.InheritedClasses.G" toClass="NunitTests.InheritedClasses.M" cardinality="oneToOne" target="M" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="true" inverse="false"> <entry fromAttribute="MOID" toAttribute="OIDValue"/> </association> <association fromClass="NunitTests.InheritedClasses.K" toClass="NunitTests.InheritedClasses.M" cardinality="oneToOne" target="M" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="true" inverse="false"> <entry fromAttribute="MOID" toAttribute="OIDValue"/> </association> <association fromClass="NunitTests.InheritedClasses.A" toClass="NunitTests.InheritedClasses.C" cardinality="oneToOne" target="C" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="true" inverse="false"> <entry fromAttribute="COID" toAttribute="OIDValue"/> </association> <association fromClass="NunitTests.InheritedClasses.B" toClass="NunitTests.InheritedClasses.N" cardinality="oneToMany" target="NCol" retrieveAutomatic="true" deleteAutomatic="true" saveAutomatic="true" inverse="false"> <entry fromAttribute="OIDValue" toAttribute="BOID"/> </association> <association fromClass="NunitTests.InheritedClasses.N" toClass="NunitTests.InheritedClasses.B" cardinality="oneToOne" target="B" retrieveAutomatic="true" deleteAutomatic="false" saveAutomatic="false" inverse="false"> <entry fromAttribute="BOID" toAttribute="OIDValue"/> </association> <class name="LazyEmployee" table="NPEmployee" database="MSA" namespace="NunitTests.StandardClasses"> <attribute name="Name" column="name" find="true" key="primary"/> <attribute name="ReportsToName" column="parentname" /> <attribute name="ReportsTo" /> <attribute name="Workers" /> </class> <association fromClass="NunitTests.StandardClasses.LazyEmployee" toClass="NunitTests.StandardClasses.LazyEmployee" target="ReportsTo" cardinality="OneToOne" retrieveAutomatic="lazy" saveAutomatic="true" deleteAutomatic="false" inverse="false"> <entry fromAttribute="ReportsToName" toAttribute="Name"/> </association> <association fromClass="NunitTests.StandardClasses.LazyEmployee" toClass="NunitTests.StandardClasses.LazyEmployee" target="Workers" cardinality="OneToMany" retrieveAutomatic="lazy" saveAutomatic="true" deleteAutomatic="false" inverse="false"> <entry fromAttribute="Name" toAttribute="ReportsToName"/> </association> <class name="M2MA" table="ManyToManyA" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="GUIDValue" column="GuidValue" key="primary"/> <attribute name="Description" column="description" /> <attribute name="M2MBCollection" /> </class> <class name="M2MB" table="ManyToManyB" database="MSA" namespace="NunitTests.InheritedClasses"> <attribute name="GUIDValue" column="GuidValue" key="primary"/> <attribute name="Description" column="description" /> <attribute name="M2MACollection" /> </class> <association fromClass="NunitTests.InheritedClasses.M2MA" toClass="NunitTests.InheritedClasses.M2MB" cardinality="ManyToMany" fromClassTarget="M2MBCollection" toClassTarget="M2MACollection" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="true"> <associationTable name="ManyToManyAB"> <fromClassKey name="GUIDValue" column="AGuidValue" /> <toClassKey name="GUIDValue" column="BGuidValue" /> </associationTable> </association> <class name="iM2MA" table="ManyToManyA" database="MSA" namespace="NunitTests.Interfaces" factory="M2MAFactory"> <attribute name="GUIDValue" column="GuidValue" key="primary"/> <attribute name="Description" column="description" /> <attribute name="M2MBCollection" /> </class> <class name="iM2MB" table="ManyToManyB" database="MSA" namespace="NunitTests.Interfaces" factory="M2MBFactory"> <attribute name="GUIDValue" column="GuidValue" key="primary"/> <attribute name="Description" column="description" /> <attribute name="M2MACollection" /> </class> <association fromClass="NunitTests.Interfaces.iM2MA" toClass="NunitTests.Interfaces.iM2MB" cardinality="ManyToMany" fromClassTarget="M2MBCollection" toClassTarget="M2MACollection" retrieveAutomatic="true" saveAutomatic="true" deleteAutomatic="true"> <associationTable name="ManyToManyAB"> <fromClassKey name="GUIDValue" column="AGuidValue" /> <toClassKey name="GUIDValue" column="BGuidValue" /> </associationTable> </association> <class name="IOptimistic" table="NPOptimistic" database="MSA" namespace="NunitTests.Interfaces" factory="IOptimisticFactory"> <attribute name="GUIDValue" column="GuidValue" key="primary"/> <attribute name="Description" column="Description" /> <attribute name="CreatedDate" column="CreatedDate" timestamp="true" /> <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" /> </class> </map> |
Update of /cvsroot/jcframework/dotnet/Nunit/InheritedClasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv815/Nunit/InheritedClasses Added Files: AtomsFrameworkTests.vb AutoIdClasses.vb AutoIdTests.vb CEmployee.vb CJob.vb CSharedClasses.vb CStudent.vb CTeam.vb CWorker.vb ManyToManyClasses_v2.vb ManyToManyTests_v2.vb MultiRetrieveTestClasses.vb MultiRetrieveTests.vb RetrieveCriteriaTests.vb SharedTests.vb SuperClassTests.vb TableA_B.vb tblAtoKClasses.vb Log Message: Name changes to bring class library into line with Microsoft naming standards. FxCop directory added Nunit tests moved into main repository --- NEW FILE: CJob.vb --- Imports AtomsFramework Namespace InheritedClasses <AFTable("jobs", "MSA", AFTableAttribute.KeyType.useOIDValue, OIDcolumn:="oidvalue")> _ Public Class CJob Inherits PersistentObject Private m_description As String <AFColumn("description", Find:=True)> _ Public Property Description() As String Get Return m_description End Get Set(ByVal Value As String) m_description = Value SetDirtyFlag() End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New CJob End Function Public Overrides Function IsValid() As Boolean Return True End Function End Class End Namespace --- NEW FILE: MultiRetrieveTestClasses.vb --- Imports AtomsFramework Namespace InheritedClasses Public Class mr1 Inherits PersistentObject Private _id As String Private _mr2_id As String Private _mr2 As mr2 Private _field1 As String Private _field2 As Integer Public Property id() As String Get Return _id End Get Set(ByVal Value As String) _id = Value SetDirtyFlag() End Set End Property Public Property mr2_id() As String Get If Not _mr2 Is Nothing Then Return _mr2.id End If Return _mr2_id End Get Set(ByVal Value As String) _mr2_id = Value SetDirtyFlag() End Set End Property Public Property mr2() As mr2 Get Return _mr2 End Get Set(ByVal Value As mr2) _mr2 = Value SetDirtyFlag() End Set End Property Public Property field1() As String Get Return _field1 End Get Set(ByVal Value As String) _field1 = Value SetDirtyFlag() End Set End Property Public Property field2() As Integer Get Return _field2 End Get Set(ByVal Value As Integer) _field2 = Value SetDirtyFlag() End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New mr1 End Function Public Overrides Function IsValid() As Boolean Return True End Function End Class Public Class mr2 Inherits PersistentObject Private _id As String Public Property id() As String Get Return _id End Get Set(ByVal Value As String) _id = Value SetDirtyFlag() End Set End Property Private _field1 As String Public Property field1() As String Get Return _field1 End Get Set(ByVal Value As String) _field1 = Value SetDirtyFlag() End Set End Property Private _field2 As Integer Public Property field2() As Integer Get Return _field2 End Get Set(ByVal Value As Integer) _field2 = Value SetDirtyFlag() End Set End Property Private _mr3_id As String Private _mr3 As mr3 Public Property mr3_id() As String Get If Not _mr3 Is Nothing Then Return _mr3.id End If Return _mr3_id End Get Set(ByVal Value As String) _mr3_id = Value SetDirtyFlag() End Set End Property Public Property mr3() As mr3 Get Return _mr3 End Get Set(ByVal Value As mr3) _mr3 = Value SetDirtyFlag() End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New mr2 End Function Public Overrides Function IsValid() As Boolean Return True End Function End Class Public Class mr3 Inherits PersistentObject Private _id As String Public Property id() As String Get Return _id End Get Set(ByVal Value As String) _id = Value SetDirtyFlag() End Set End Property Private _field1 As String Public Property field1() As String Get Return _field1 End Get Set(ByVal Value As String) _field1 = Value SetDirtyFlag() End Set End Property Private _field2 As Integer Public Property field2() As Integer Get Return _field2 End Get Set(ByVal Value As Integer) _field2 = Value SetDirtyFlag() End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New mr3 End Function Public Overrides Function IsValid() As Boolean Return True End Function End Class End Namespace --- NEW FILE: TableA_B.vb --- Imports AtomsFramework Namespace InheritedClasses Public Class TableA Inherits PersistentObject Private _id As String Public Property Id() As String Get Return _id End Get Set(ByVal Value As String) _id = Value SetDirtyFlag() End Set End Property Private _field1 As String Public Property field1() As String Get Return _field1 End Get Set(ByVal Value As String) _field1 = Value SetDirtyFlag() End Set End Property Private WithEvents _tableBCol As New PersistentObjectCollection Public Property TableBCollection() As PersistentObjectCollection Get Return _tableBCol End Get Set(ByVal Value As PersistentObjectCollection) _tableBCol = Value End Set End Property Private _tableCCol As New PersistentObjectCollection Public Property TableCCollection() As PersistentObjectCollection Get Return _tableCCol End Get Set(ByVal Value As PersistentObjectCollection) _tableCCol = Value End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New TableA End Function Public Overrides Function IsValid() As Boolean Return True End Function Private Sub _tableBCol_ItemDirtied(ByVal sender As Object, ByVal e As System.EventArgs) Handles _tableBCol.ItemDirtied Me.SetDirtyFlag() End Sub Private Sub _tableBCol_ObjectAdded(ByVal index As Integer, ByRef value As Object) Handles _tableBCol.ObjectAdded Me.SetDirtyFlag() End Sub Private Sub _tableBCol_ObjectRemoved(ByVal index As Integer, ByRef value As Object) Handles _tableBCol.ObjectRemoved Me.SetDirtyFlag() End Sub End Class Public Class TableB Inherits PersistentObject Private _id As String Public Property Id() As String Get Return _id End Get Set(ByVal Value As String) _id = Value SetDirtyFlag() End Set End Property Private _field1 As String Public Property field1() As String Get Return _field1 End Get Set(ByVal Value As String) _field1 = Value SetDirtyFlag() End Set End Property Private _a As TableA Private _a_id As String Public Property TableA() As TableA Get Return _a End Get Set(ByVal Value As TableA) _a = Value SetDirtyFlag() End Set End Property Public Property AId() As String Get If _a Is Nothing Then Return _a_id End If Return _a.Id End Get Set(ByVal Value As String) _a_id = Value End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New TableB End Function Public Overrides Function IsValid() As Boolean Return True End Function End Class Public Class TableC Inherits PersistentObject Private _id As String Public Property Id() As String Get Return _id End Get Set(ByVal Value As String) _id = Value SetDirtyFlag() End Set End Property Private _field1 As String Public Property field1() As String Get Return _field1 End Get Set(ByVal Value As String) _field1 = Value SetDirtyFlag() End Set End Property Private _a As TableA Private _a_id As String Public Property TableA() As TableA Get Return _a End Get Set(ByVal Value As TableA) _a = Value SetDirtyFlag() End Set End Property Public Property AId() As String Get If _a Is Nothing Then Return _a_id End If Return _a.Id End Get Set(ByVal Value As String) _a_id = Value End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New TableC End Function Public Overrides Function IsValid() As Boolean Return True End Function End Class End Namespace --- NEW FILE: RetrieveCriteriaTests.vb --- Imports AtomsFramework Imports NUnit.Framework Namespace InheritedClasses <TestFixture()> Public Class RetrieveCriteriaTests Private pbroker As PersistenceBroker Private emp As CEmployee Private r As RetrieveCriteria Private mr As MultiRetrieveCriteria Private c As ResultCursor <TestFixtureSetUp()> Public Sub Init() Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory Dim retry As Boolean = True While retry = True Try 'Remove any existing test database System.IO.File.Delete(".\db1.mdb") retry = False Catch iox As IO.IOException 'file is in use - so we will loop around until it is released GC.Collect() Catch ex As Exception retry = False End Try End While System.IO.File.Copy(".\original db1.mdb", ".\db1.mdb") pbroker = New PersistenceBroker pbroker.init() End Sub <TestFixtureTearDown()> Public Sub Dispose() pbroker.Dispose() pbroker = Nothing End Sub <SetUp()> Public Sub testInit() emp = New CEmployee End Sub <Test()> Public Sub SingleClassRetrieve() r = New RetrieveCriteria r.ClassMap = emp.getClassMap c = r.perform Assert.IsTrue(c.hasElements) Assert.IsTrue(Not c.EOF) Assert.IsTrue(c.HoldsProxies) Assert.AreEqual(c.ResultSet.ResultSet.Tables(0).Rows.Count, 6) End Sub <Test()> Public Sub MultiRetrieveTest1() Dim si As SelectInCriteria mr = New MultiRetrieveCriteria(emp) mr.WhereCondition.addSelectEqualTo("Name", "ac") si = New SelectInCriteria(emp) si.WhereCondition.addSelectEqualTo("Name", "ac") si.SetSelectAttribute("Name") mr.WhereCondition.addSelectNotIn("Name", si) c = mr.perform Assert.IsFalse(c.hasElements) Assert.IsTrue(c.EOF) End Sub <Test()> Public Sub RetrieveCriteriaOffset() r = New RetrieveCriteria r.ClassMap = emp.getClassMap r.RowLimit = 1 r.Offset = 1 c = r.perform Assert.IsTrue(c.hasElements) Assert.AreEqual(1, c.TotalRows) End Sub <Test()> Public Sub LoadFullObjects() r = New RetrieveCriteria r.ReturnFullObjects = True c = r.perform(emp) Assert.IsFalse(c.HoldsProxies) While c.hasElements And Not c.EOF emp = New CEmployee c.loadObject(emp) Assert.IsTrue(emp.Persistent) c.nextCursor() End While c.SetCursor(0) emp = New CEmployee c.loadObject(emp) Assert.AreEqual(emp.Name, "ab") End Sub <Test()> Public Sub SimpleOrCriteria() r = New RetrieveCriteria r.ClassMap = emp.getClassMap r.WhereCondition.addSelectEqualTo("Name", "aa") r.WhereCondition.addSelectEqualTo("Name", "b", True) c = r.perform Assert.IsTrue(c.hasElements) Assert.AreEqual(c.ResultSet.ResultSet.Tables(0).Rows.Count, 2) c.loadObject(emp) Assert.AreEqual(emp.Name, "aa") c.nextCursor() emp = New CEmployee c.loadObject(emp) Assert.AreEqual(emp.Name, "b") End Sub <Test()> Public Sub SelectInList() Dim al As New ArrayList al.Add("aa") al.Add("b") r = New RetrieveCriteria r.ClassMap = emp.getClassMap r.WhereCondition.addSelectInList("Name", al) c = r.perform Assert.IsTrue(c.hasElements) Assert.AreEqual(c.ResultSet.ResultSet.Tables(0).Rows.Count, 2) c.loadObject(emp) Assert.AreEqual(emp.Name, "aa") c.nextCursor() emp = New CEmployee c.loadObject(emp) Assert.AreEqual(emp.Name, "b") End Sub <Test()> Public Sub SubCriteria() Dim xx_1 As New CriteriaCondition Dim xx_2 As New CriteriaCondition Dim xx_3 As New CriteriaCondition Dim xx_4 As New CriteriaCondition r = New RetrieveCriteria r.ClassMap = emp.getClassMap xx_1.ClassMap = r.ClassMap xx_2.ClassMap = r.ClassMap xx_3.ClassMap = r.ClassMap xx_4.ClassMap = r.ClassMap xx_1.addSelectEqualTo("Name", "aa") xx_2.addSelectEqualTo("Name", "ab") xx_1.addSubCriteria(xx_2, True) xx_3.addSelectEqualTo("Name", "ab") xx_4.addSelectEqualTo("Name", "ac") xx_3.addSubCriteria(xx_4, True) r.WhereCondition.addSubCriteria(xx_1, True) r.WhereCondition.addSubCriteria(xx_3, False) c = r.perform Assert.IsTrue(c.hasElements) Assert.AreEqual(c.ResultSet.ResultSet.Tables(0).Rows.Count, 1) While c.hasElements And Not c.EOF emp = New CEmployee c.loadObject(emp) Assert.AreEqual(emp.Name, "ab") c.nextCursor() End While End Sub End Class End Namespace --- NEW FILE: ManyToManyClasses_v2.vb --- Imports AtomsFramework Namespace InheritedClasses #Region "M2MA" Public Class M2MA Inherits PersistentObject Private _description As String Private WithEvents _bCol As M2MBCollection Public Property Description() As String Get Return _description End Get Set(ByVal Value As String) _description = Value SetDirtyFlag() End Set End Property Public Property M2MBCollection() As M2MBCollection Get Return _bCol End Get Set(ByVal Value As M2MBCollection) _bCol = Value End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New M2MA End Function Public Overrides Function IsValid() As Boolean Return True End Function Public Sub New() _bCol = New M2MBCollection End Sub Private Sub _bCol_ListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles _bCol.ListChanged Me.SetDirtyFlag() End Sub End Class #End Region #Region "M2MB" Public Class M2MB Inherits PersistentObject Private _description As String Private _aCol As M2MACollection Public Property Description() As String Get Return _description End Get Set(ByVal Value As String) _description = Value SetDirtyFlag() End Set End Property Public Property M2MACollection() As M2MACollection Get Return _aCol End Get Set(ByVal Value As M2MACollection) _aCol = Value End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New M2MB End Function Public Overrides Function IsValid() As Boolean Return True End Function Public Sub New() _aCol = New M2MACollection End Sub End Class #End Region #Region "M2MACollection" Public Class M2MACollection Inherits PersistentObjectCollection Public Overloads Sub Add(ByVal a As M2MA) list.Add(a) End Sub Public Shadows Function Item(ByVal index As Integer) As M2MA Return CType(MyBase.Item(index), M2MA) End Function End Class #End Region #Region "M2MBCollection" Public Class M2MBCollection Inherits PersistentObjectCollection Public Overloads Sub Add(ByVal b As M2MB) list.Add(b) End Sub Public Shadows Function Item(ByVal index As Integer) As M2MB Return CType(MyBase.Item(index), M2MB) End Function End Class #End Region End Namespace --- NEW FILE: AtomsFrameworkTests.vb --- Imports AtomsFramework Imports NUnit.Framework Namespace InheritedClasses <TestFixture()> Public Class _BasicTests Private pbroker As PersistenceBroker Private emp As CEmployee Private job As CJob Private team As CTeam Dim WithEvents coll As PersistentObjectCollection Private eventcount As Integer <TestFixtureSetUp()> Public Sub Init() Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory Dim retry As Boolean = True While retry = True Try 'Remove any existing test database System.IO.File.Delete(".\db1.mdb") retry = False Catch iox As IO.IOException GC.Collect() 'file is in use - so we will loop around until it is released Catch ex As Exception retry = False End Try End While System.IO.File.Copy(".\original db1.mdb", ".\db1.mdb") pbroker = New PersistenceBroker pbroker.init() End Sub <TestFixtureTearDown()> Public Sub Dispose() pbroker.Dispose() pbroker = Nothing End Sub <SetUp()> Public Sub TestInit() emp = New CEmployee job = New CJob team = New CTeam End Sub <Test()> Public Sub LoadSaveandDeleteEmployee() Dim oidvalue As String emp.Name = "new" emp.Find() Assert.IsFalse(emp.Persistent) oidvalue = emp.OIDValue emp.Save() Assert.IsTrue(emp.Persistent) Assert.IsTrue(emp.ReportsTo Is Nothing) Assert.IsFalse(emp.IsReferenced) emp = New CEmployee emp.Name = "new" emp.Find() Assert.IsTrue(emp.Persistent) Assert.AreEqual(emp.OIDValue, oidvalue) Assert.AreEqual(emp.Name, "new") emp.Delete() Assert.IsFalse(emp.Persistent) emp = New CEmployee emp.Name = "new" emp.Find() Assert.IsFalse(emp.Persistent) Assert.IsTrue(emp.OIDValue <> oidvalue) End Sub <Test()> Public Sub ChangeFindFieldValue() Dim oidvalue As String emp.Name = "SaveThenChange" emp.Find() Assert.IsFalse(emp.Persistent) oidvalue = emp.OIDValue emp.Save() Assert.IsTrue(emp.Persistent) Assert.IsTrue(emp.ReportsTo Is Nothing) Assert.IsFalse(emp.IsReferenced) emp = New CEmployee emp.Name = "SaveThenChange" emp.Find() Assert.IsTrue(emp.Persistent) Assert.AreEqual(emp.OIDValue, oidvalue) Assert.AreEqual(emp.Name, "SaveThenChange") emp.Name = "Changed" emp.Save() Assert.IsTrue(emp.Persistent) emp.Delete() Assert.IsFalse(emp.Persistent) emp = New CEmployee emp.Name = "Changed" emp.Find() Assert.IsFalse(emp.Persistent) emp = New CEmployee emp.Name = "SaveThenChange" emp.Find() Assert.IsFalse(emp.Persistent) End Sub <Test()> Public Sub SetPropertyToNothing() Dim oidvalue As String emp.Name = "SomeNewEmp" emp.Find() Assert.IsFalse(emp.Persistent) oidvalue = emp.OIDValue emp.Save() emp = New CEmployee emp.Name = "SomeNewEmp" emp.Find() Assert.IsTrue(emp.Persistent) Assert.AreEqual(emp.OIDValue, oidvalue) Assert.AreEqual(emp.Name, "SomeNewEmp") emp.Name = Nothing emp.Save() Assert.IsTrue(emp.Persistent) End Sub <Test()> Public Sub DeleteMultipleEmployees() emp.Name = "DeleteMe1" emp.Save() emp = New CEmployee emp.Name = "DeleteMe2" emp.Save() emp = New CEmployee emp.Name = "DeleteMe3" emp.Save() Dim dc As DeleteCriteria dc = New DeleteCriteria dc.ClassMap = emp.getClassMap dc.WhereCondition.addSelectLike("Name", "DeleteMe%") Dim i As Integer = dc.perform() Assert.AreEqual(i, 3) emp = New CEmployee emp.Name = "DeleteMe1" emp.Find() Assert.IsFalse(emp.Persistent) emp = New CEmployee emp.Name = "DeleteMe2" emp.Find() Assert.IsFalse(emp.Persistent) emp = New CEmployee emp.Name = "DeleteMe3" emp.Find() Assert.IsFalse(emp.Persistent) End Sub <Test()> Public Sub LoadEmployee_ac() emp.Name = "ac" emp.Find() Assert.IsTrue(emp.Persistent) Assert.AreEqual(emp.Workers.Count, 3) emp = CType(emp.Workers.Item(1), CEmployee) Assert.AreEqual(emp.Name, "aa") Assert.AreEqual(emp.ReportsTo.Name, "ac") End Sub <Test()> Public Sub LoadEmployee_a() emp.Name = "a" emp.Find() Assert.IsTrue(emp.Persistent) Assert.AreEqual(emp.Workers.Count, 0) Assert.IsTrue(Not emp.ReportsTo Is Nothing) Assert.AreEqual(emp.ReportsTo.Name, "c") End Sub <Test(), ExpectedException(GetType(AssertionException))> _ Public Sub CheckCacheCopiesAreDifferent() Dim emp2 As CEmployee emp.Name = "ac" emp.Find() emp2 = New CEmployee emp2.Find() Assert.AreSame(emp2, emp) End Sub <Test()> Public Sub PersistentObjectEquality() Dim emp2 As CEmployee emp.Name = "ac" emp.Find() emp2 = New CEmployee emp2.Name = "aa" emp2.Find() Assert.IsTrue(PersistentObject.Equals(emp2.ReportsTo, emp)) Assert.IsTrue(emp.Equals(emp2.ReportsTo)) End Sub <Test()> Public Sub CheckSchemaBasedProperties() emp.Name = "ac" emp.Find() Assert.AreEqual(emp.getFieldLengthByName("Name"), 50) Assert.IsTrue(emp.getFieldTypeByName("Name") Is GetType([String])) End Sub <Test()> Public Sub CacheTest() emp.Name = "Initial" emp.Find() Assert.IsFalse(emp.Persistent) emp.Save() pbroker.ClearCache() emp = New CEmployee emp.Name = "Initial" emp.Find() emp.Name = "Final" emp.Save() Assert.AreEqual("Final", emp.Name) emp = New CEmployee emp.Name = "Initial" emp.Find() Assert.IsFalse(emp.Persistent) emp.Name = "Final" emp.Find() Assert.IsTrue(emp.Persistent) End Sub <Test()> Public Sub CacheTest2() 'Check that local object changes don't impact the cache emp.Name = "Initial2" emp.Find() Assert.IsFalse(emp.Persistent) emp.Save() pbroker.ClearCache() emp = New CEmployee emp.Name = "Initial2" emp.Find() 'Change local copy emp.Name = "Final" emp = New CEmployee emp.Name = "Initial2" emp.Find() Assert.AreEqual("Initial2", emp.Name) End Sub <Test()> Public Sub AutoDelete() Dim a As New TableA Dim b As New TableB Dim cc As ResultCursor a.Id = "a1" a.Retrieve() Assert.IsTrue(a.Persistent) Assert.AreEqual(2, a.TableBCollection.Count) a.Delete() Dim rc As New RetrieveCriteria rc.ClassMap = b.getClassMap rc.WhereCondition.addSelectEqualTo("AId", "a1") cc = rc.perform() Assert.AreEqual(0, cc.TotalRows) Assert.IsFalse(cc.hasElements) End Sub <Test()> Public Sub AutoSave() Dim a As New TableA Dim b As New TableB Dim cc As ResultCursor a.Id = "a3" b.Id = "b33" b.TableA = a a.TableBCollection.Add(b) a.Save() Dim rc As New RetrieveCriteria rc.ClassMap = b.getClassMap rc.WhereCondition.addSelectEqualTo("AId", "a3") cc = rc.perform() Assert.AreEqual(1, cc.TotalRows) Assert.IsTrue(cc.hasElements) End Sub <Test()> Public Sub CheckForDuplicates() 'Tests is multiple one-to-many associations in an object causes 'duplicates in a collection. Dim a As New TableA Dim b As New TableB Dim c As New TableC a.Id = "aa" b.Id = "bb1" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bb2" b.TableA = a a.TableBCollection.Add(b) c = New TableC c.Id = "cc1" c.TableA = a a.TableCCollection.Add(c) c = New TableC c.Id = "cc2" c.TableA = a a.TableCCollection.Add(c) c = New TableC c.Id = "cc3" c.TableA = a a.TableCCollection.Add(c) c = New TableC c.Id = "cc4" c.TableA = a a.TableCCollection.Add(c) a.Save() pbroker.ClearCache() a = New TableA a.Id = "aa" a.Retrieve() Assert.AreEqual(2, a.TableBCollection.Count) Assert.AreEqual(4, a.TableCCollection.Count) End Sub <Test()> Public Sub CheckCacheBehaviour() Dim a As New TableA Dim b As New TableB Dim c As New TableC a.Id = "aaa" b.Id = "bbb1" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bbb2" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bbb3" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bbb4" b.TableA = a a.TableBCollection.Add(b) c = New TableC c.Id = "ccc1" c.TableA = a a.TableCCollection.Add(c) c = New TableC c.Id = "ccc2" c.TableA = a a.TableCCollection.Add(c) a.Save() Assert.AreEqual(4, a.TableBCollection.Count) Assert.AreEqual(2, a.TableCCollection.Count) pbroker.ClearCache() a = New TableA a.Id = "aaa" a.Retrieve(a) Assert.AreEqual(4, a.TableBCollection.Count) Assert.AreEqual(2, a.TableCCollection.Count) b = a.TableBCollection(2) b.field1 = "a3" b.Id = "bbb5" Debug.WriteLine(pbroker.DumpCacheDetails()) a = New TableA a.Id = "aaa" a.Retrieve(a, False) 'Bug existed where code above caused cached objects to change values Assert.AreEqual("bbb3", CType(a.TableBCollection(2), TableB).Id) a.field1 = "aa2" a.Save() a = New TableA a.Id = "aaa" a.Retrieve(a, False) Assert.AreEqual(4, a.TableBCollection.Count) Assert.AreEqual(2, a.TableCCollection.Count) End Sub <Test()> Public Sub CheckCollectionEvents() coll = New PersistentObjectCollection eventcount = 0 emp = New CEmployee emp.Name = "somename" coll.Add(emp) emp = New CEmployee emp.Name = "someOtherName" coll.Add(emp) coll.Remove(0) Assert.AreEqual(1, coll.Count) Assert.AreEqual("someOtherName", CType(coll.Item(0), CEmployee).Name) Assert.AreEqual(3, eventcount) End Sub Private Sub coll_ObjectAdded(ByVal index As Integer, ByRef value As Object) Handles coll.ObjectAdded eventcount += 1 If eventcount = 1 Then Assert.AreEqual(0, index) Assert.AreEqual("somename", CType(value, CEmployee).Name) End If If eventcount = 2 Then Assert.AreEqual(1, index) Assert.AreEqual("someOtherName", CType(value, CEmployee).Name) End If End Sub Private Sub coll_ObjectRemoved(ByVal index As Integer, ByRef value As Object) Handles coll.ObjectRemoved eventcount += 1 If eventcount = 3 Then Assert.AreEqual(0, index) Assert.AreEqual("somename", CType(value, CEmployee).Name) End If End Sub <Test()> Public Sub CheckCacheAfterRollback() Dim oid As String Dim e2 As CEmployee emp.Name = "me" emp.Save() oid = emp.OIDValue pbroker.startTransaction() emp.Name = "you" emp.Save() e2 = New CEmployee e2.OIDValue = oid e2.Retrieve() Assert.AreEqual("you", e2.Name) pbroker.rollback() e2 = New CEmployee e2.OIDValue = oid e2.Retrieve() Assert.AreEqual("me", e2.Name) End Sub <Test()> Public Sub CheckCacheAfterRollback2() 'Check that items are put back into collections and that deleted items are restored Dim a As New TableA Dim b As New TableB Dim a1 As New TableA a.Id = "1a" b.Id = "1b" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "2b" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "3b" b.TableA = a a.TableBCollection.Add(b) a.Save() Assert.AreEqual(3, a.TableBCollection.Count) pbroker.startTransaction() a1.Id = "1a" a1.Retrieve() Assert.AreEqual(3, a1.TableBCollection.Count) b = a.TableBCollection.Item(1) Assert.AreEqual("2b", b.Id) a.TableBCollection.Remove(1) b.Delete() Assert.AreEqual(2, a.TableBCollection.Count) a.Save() a1 = New TableA a1.Id = "1a" a1.Retrieve() b = New TableB b.Id = "2b" b.Retrieve() Assert.IsFalse(b.Persistent) Assert.AreEqual(2, a1.TableBCollection.Count) 'Now abort the transaction pbroker.rollback() a1 = New TableA a1.Id = "1a" a1.Retrieve() b = New TableB b.Id = "2b" b.Retrieve() Assert.IsTrue(b.Persistent) Assert.AreEqual(3, a1.TableBCollection.Count) Assert.AreEqual("2b", CType(a1.TableBCollection.Item(1), TableB).Id) End Sub <Test()> Public Sub CheckCacheAfterRollback3() 'Check that null collections are correctly handled Dim a As New TableA Dim b As New TableB Dim a1 As New TableA a.Id = "aa1a" a.TableBCollection = Nothing a.TableCCollection = Nothing a.Save() Assert.IsNull(a.TableBCollection) pbroker.startTransaction() a1.Id = "aa1a" a1.Retrieve() a1.TableBCollection = New PersistentObjectCollection b.Id = "b1b" b.TableA = a1 a1.TableBCollection.Add(b) Assert.AreEqual(1, a1.TableBCollection.Count) a1.Save() a1 = New TableA a1.Id = "aa1a" a1.Retrieve() b = New TableB b.Id = "b1b" b.Retrieve() Assert.IsTrue(b.Persistent) Assert.AreEqual(1, a1.TableBCollection.Count) 'Now abort the transaction pbroker.rollback() a1 = New TableA a1.Id = "aa1a" a1.Retrieve() b = New TableB b.Id = "b1b" b.Retrieve() Assert.IsFalse(b.Persistent) Assert.IsNull(a1.TableBCollection) End Sub <Test()> Public Sub CheckCacheAfterRollback4() 'Add and remove items in the collection during the transaction Dim a As New TableA Dim b As New TableB Dim a1 As New TableA a.Id = "aa4" b.Id = "bb41" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bb42" b.TableA = a a.TableBCollection.Add(b) a.Save() Assert.AreEqual(2, a.TableBCollection.Count) pbroker.startTransaction() a1.Id = "aa4" a1.Retrieve() Assert.AreEqual(2, a1.TableBCollection.Count) b = New TableB b.Id = "bb43" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bb44" b.TableA = a a.TableBCollection.Add(b) b = a.TableBCollection.Item(1) Assert.AreEqual("bb42", b.Id) a.TableBCollection.Remove(1) b.Delete() Assert.AreEqual(3, a.TableBCollection.Count) a.Save() a1 = New TableA a1.Id = "aa4" a1.Retrieve() b = New TableB b.Id = "bb42" b.Retrieve() Assert.IsFalse(b.Persistent) Assert.AreEqual(3, a1.TableBCollection.Count) 'Now abort the transaction pbroker.rollback() a1 = New TableA a1.Id = "aa4" a1.Retrieve() b = New TableB b.Id = "bb42" b.Retrieve() Assert.IsTrue(b.Persistent) Assert.AreEqual(2, a1.TableBCollection.Count) Assert.AreEqual("bb42", CType(a1.TableBCollection.Item(1), TableB).Id) End Sub <Test()> Public Sub CheckCacheAfterRollback5() 'Modify but don't save an object during a transaction Dim a As New TableA Dim b As New TableB Dim a1 As New TableA a.Id = "aa5" b.Id = "bb51" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bb52" b.TableA = a a.TableBCollection.Add(b) a.Save() Assert.AreEqual(2, a.TableBCollection.Count) pbroker.startTransaction() a1.Id = "aa5" a1.Retrieve() Assert.AreEqual(2, a1.TableBCollection.Count) b = New TableB b.Id = "bb53" b.TableA = a a.TableBCollection.Add(b) b = New TableB b.Id = "bb54" b.TableA = a a.TableBCollection.Add(b) b = a.TableBCollection.Item(1) Assert.AreEqual("bb52", b.Id) a.TableBCollection.Remove(1) Assert.AreEqual(3, a.TableBCollection.Count) 'Now abort the transaction pbroker.rollback() a1 = New TableA a1.Id = "aa5" a1.Retrieve() 'Will get from cache Assert.AreEqual(2, a1.TableBCollection.Count) Assert.AreEqual("bb52", CType(a1.TableBCollection.Item(1), TableB).Id) End Sub <Test()> Public Sub SaveThenSaveWithoutRetrieve() Dim oidvalue As String emp.Name = "SaveThisEmp" emp.Find() Assert.IsFalse(emp.Persistent) oidvalue = emp.OIDValue emp.Save() emp = New CEmployee emp.OIDValue = oidvalue emp.Name = "Should update record" emp.Save() Assert.IsTrue(emp.Persistent, "persistent check failed") End Sub <Test()> Public Sub CheckEvents() AddHandler emp.NameChanged, AddressOf NameChanged eventcount = 0 emp.Name = "Events" Assert.AreEqual(1, eventcount) emp.Find() Assert.IsFalse(emp.Persistent) emp.Save() emp = New CEmployee emp.Name = "Events" emp.Find() 'Should not have any events from the previous handler still firing eventcount = 0 emp.Name = "New Name 1" Assert.AreEqual(0, eventcount) AddHandler emp.NameChanged, AddressOf NameChanged emp.Name = "New Name 2" Assert.AreEqual(1, eventcount) End Sub <Test()> Public Sub CheckEvents2() AddHandler emp.NameChanged, AddressOf NameChanged eventcount = 0 emp.Name = "Events2" Assert.AreEqual(1, eventcount) emp.Find() Assert.IsFalse(emp.Persistent) emp.Save() emp = New CEmployee eventcount = 0 AddHandler emp.NameChanged, AddressOf NameChanged emp.Name = "Events2" Assert.AreEqual(1, eventcount) 'Should retain the event handlers emp.Find() emp.Name = "New Name 1" Assert.AreEqual(2, eventcount) End Sub <Test()> Public Sub CheckEvents3() AddHandler emp.NameChanged, AddressOf NameChanged eventcount = 0 emp.Name = "Events3" Assert.AreEqual(1, eventcount) emp.Find() Assert.IsFalse(emp.Persistent) emp.Save() pbroker.ClearCache() emp = New CEmployee eventcount = 0 AddHandler emp.NameChanged, AddressOf NameChanged emp.Name = "Events3" Assert.AreEqual(1, eventcount) 'Event should fire when property is set during retrieve emp.Find() Assert.AreEqual(2, eventcount) 'Check event is still wired up after find completes emp.Name = "Events3a" Assert.AreEqual(3, eventcount) End Sub <Test()> Public Sub CheckEvents4() AddHandler emp.NameChanged, AddressOf NameChanged eventcount = 0 emp.Name = "Events4" Assert.AreEqual(1, eventcount) emp.Find() Assert.IsFalse(emp.Persistent) emp.Save() emp = New CEmployee emp.Name = "Events4" emp.Find(emp) 'Should not have any events from the previous handler still firing eventcount = 0 emp.Name = "Events4a" Assert.AreEqual(0, eventcount) AddHandler emp.NameChanged, AddressOf NameChanged emp.Name = "Events4b" Assert.AreEqual(1, eventcount) End Sub Private Sub NameChanged(ByVal sender As Object, ByVal e As System.EventArgs) eventcount += 1 End Sub End Class End Namespace --- NEW FILE: CWorker.vb --- Namespace InheritedClasses Public Class CWorker Inherits CEmployee Private m_job As String Public Property Job() As String Get Return m_job End Get Set(ByVal Value As String) m_job = Value End Set End Property End Class End Namespace --- NEW FILE: CEmployee.vb --- Imports AtomsFramework Namespace InheritedClasses <AFTable("employee", "MSA", AFTableAttribute.KeyType.UseOidValue, OIDColumn:="oid"), _ AFAssociation(GetType(CEmployee), "ReportsTo", AssociationMap.Cardinality.OneToOne, Name:="boss", Retrieve:=True), _ AFAssociationEntry("boss", "ReportsToOID", "OIDValue"), _ AFAssociation(GetType(CEmployee), "Workers", AssociationMap.Cardinality.OneToMany, Retrieve:=True), _ AFAssociationEntry("Workers", "OIDValue", "ReportsToOID")> _ Public Class CEmployee Inherits PersistentObject Private m_name As String Private m_parentoid As String Private m_parent As CEmployee Private WithEvents m_children As PersistentObjectCollection Private m_team As CTeam Private m_teamoid As String Public Event NameChanged As EventHandler <AFColumn("name", Find:=True)> _ Public Property Name() As String Get Return m_name End Get Set(ByVal Value As String) m_name = Value SetDirtyFlag() RaiseEvent NameChanged(Me, New System.EventArgs) End Set End Property Public Property ReportsTo() As CEmployee Get Return m_parent End Get Set(ByVal Value As CEmployee) If Not Value Is Nothing Then m_parent = Value m_parentoid = Value.OIDValue SetDirtyFlag() End If End Set End Property <AFColumn("parentoid")> _ Public Property ReportsToOID() As String Get If m_parent Is Nothing Then Return m_parentoid Else Return (m_parent.OIDValue) End If End Get Set(ByVal Value As String) m_parentoid = Value SetDirtyFlag() End Set End Property Public Property Workers() As PersistentObjectCollection Get Return m_children End Get Set(ByVal Value As PersistentObjectCollection) m_children = Value SetDirtyFlag() End Set End Property Public Property Team() As CTeam Get Return m_team End Get Set(ByVal Value As CTeam) If Not Value Is Nothing Then m_team = Value m_teamoid = Value.OIDValue SetDirtyFlag() End If End Set End Property <AFColumn("teamoid")> _ Public Property TeamOID() As String Get If m_team Is Nothing Then Return m_teamoid Else Return (m_team.OIDValue) End If End Get Set(ByVal Value As String) m_teamoid = Value SetDirtyFlag() End Set End Property Public Overrides Function getNewObject() As AtomsFramework.PersistentObject Return New CEmployee End Function Public Overrides Function IsValid() As Boolean Return True End Function Public Sub New() MyBase.New() m_children = New PersistentObjectCollection End Sub Private Sub m_children_ListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles m_children.ListChanged Me.SetDirtyFlag() End Sub End Class End Namespace --- NEW FILE: SuperClassTests.vb --- Imports AtomsFramework Imports NUnit.Framework Namespace InheritedClasses <TestFixture()> Public Class SuperClassTests Private pbroker As PersistenceBroker <TestFixtureSetUp()> Public Sub Init() Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory Dim retry As Boolean = True While retry = True Try 'Remove any existing test database System.IO.File.Delete(".\db1.mdb") retry = False Catch iox As IO.IOException GC.Collect() 'file is in use - so we will loop around until it is released Catch ex As Exception retry = False End Try End While System.IO.File.Copy(".\original db1.mdb", ".\db1.mdb") pbroker = New PersistenceBroker pbroker.init() End Sub <TestFixtureTearDown()> Public Sub Dispose() pbroker.Dispose() pbroker = Nothing End Sub <SetUp()> Public Sub TestInit() End Sub <TearDown()> Public Sub TestEnd() pbroker.ClearCache() Dim col As PersistentObjectCollection Dim cpo As PersistentObject = New A col = cpo.getAll(True) For Each a As A In col a.Delete(True) Next pbroker.ClearCache() End Sub <Test()> Public Sub CheckMultiInheritance1() Dim root As New A root.Id = 1 root.Text = "Root object" root.BCol = New PersistentObjectCollection ' create G and add it to the collection Dim g As New G g.Id = 5 g.Text = "Child class of E" g.Str = "Added to collection" g.I = 555 g.A = root root.BCol.Add(g) ' create oneToOne object (K) and add it to root Dim k As New K k.Id = 6 k.Text = "Child of class H" k.Str = "Added to oneToOne association" k.I = 666 root.C = k 'save root (class A) root.Save(True) 'Now check that A, G and K are in the database pbroker.ClearCache() Dim col As PersistentObjectCollection Dim cpo As PersistentObject = New A col = cpo.getAll(True) Assert.IsTrue(col.Count > 0) For Each a As A In col Assert.IsTrue(a.C.GetType Is GetType(K)) For Each b As B In a.BCol Assert.IsTrue(b.GetType Is GetType(G)) Next Next End Sub <Test()> Public Sub CheckMultiInheritance2() Dim root As New A root.Id = 1 root.Text = "Root object" root.BCol = New PersistentObjectCollection ' create G and add it to the collection Dim g As New G g.Id = 5 g.Text = "Child class of E" g.Str = "Added to collection" g.I = 555 g.A = root root.BCol.Add(g) ' create oneToOne object (K) and add it to root Dim k As New K k.Id = 6 k.Text = "Child of class H" k.Str = "Added to oneToOne association" k.I = 666 root.C = k 'save root (class A) root.Save(True) 'Now check that A, G and K are in the database pbroker.ClearCache() Dim col As PersistentObjectCollection Dim cpo As PersistentObject = New A col = cpo.getAll(True) Assert.IsTrue(col.Count > 0) For Each a As A In col Assert.IsNull(CType(CType(a.C, K).M, M), "Object is not NULL") For Each b As B In a.BCol Assert.IsTrue(b.GetType Is GetType(G)) Assert.IsNull(CType(CType(b, G).M1, M), "Object is not NULL") Next Next End Sub <Test()> Public Sub RetrievalViaParentAttributes() Dim j As New J j.I = 1 j.Id = 123 j.Text = "Class C Text" j.Str = "Class H Str" j.Save() j = New J Dim rc As New RetrieveCriteria rc.ClassMap = j.getClassMap Dim condition As New CriteriaCondition condition.ClassMap = j.getClassMap condition.Tables = rc.Tables condition.addSelectEqualTo("Text", "Class C Text") rc.WhereCondition = condition Dim cursor As ResultCursor = rc.perform Assert.IsTrue(cursor.hasElements) Assert.AreEqual(1, cursor.TotalRows) cursor.loadObject(j) Assert.AreEqual("Class C Text", j.Text) Assert.AreEqual("Class H Str", j.Str) Assert.AreEqual(123, j.Id) End Sub <Test()> Public Sub RetrievalViaParentAttributes2() Dim j As New J j.I = 1 j.Id = 124 j.Text = "Class C Text1" j.Str = "Class H Str" j.Save() j = New J Dim rc As New RetrieveCriteria rc.ClassMap = j.getClassMap rc.WhereCondition.addSelectEqualTo("Text", "Class C Text1") Dim cursor As ResultCursor = rc.perform Assert.IsTrue(cursor.hasElements) Assert.AreEqual(1, cursor.TotalRows) cursor.loadObject(j) Assert.AreEqual("Class C Text1", j.Text) Assert.AreEqual("Class H Str", j.Str) Assert.AreEqual(124, j.Id) End Sub <Test()> Public Sub MultiRetreiveCreteria() Dim a As A Dim b As B Dim n As N a = New A a.Id = 5 a.Text = "Instance of class A" b = New B b.Id = 1 b.Text = "Instance of class B" b.A = a a.BCol.Add(b) n = New N n.I = 7 n.B = b b.NCol.Add(n) a.Save() pbroker.ClearCache() Dim mrc As New MultiRetrieveCriteria Dim a1 As New A Dim cpo As PersistentObject Dim c As ResultCursor cpo = CType(a1, A) mrc.addObjectToJoin(a1, Nothing, "") mrc.ClassMap = cpo.getClassMap mrc.ReturnFullObjects = True mrc.WhereCondition.ClassMap = cpo.getClassMap mrc.WhereCondition.addSelectEqualTo("Id", 5) c = mrc.perform c.loadObject(cpo, pbroker) cpo.Retrieve(cpo) a1 = CType(cpo, A) Assert.AreEqual(1, a1.BCol.Count, "Number of objects in collection is greater then 1") End Sub End Class End Namespace --- NEW FILE: tblAtoKClasses.vb --- Imports AtomsFramework Namespace InheritedClasses Public Class A Inherits PersistentObject Public _id As Integer = 0 Public _text As String = String.Empty Public _c As C Public _cOID As String Public WithEvents _bCol As PersistentObjectCollection Public Sub New() _bCol = New PersistentObjectCollection Me.SetDirtyFlag() End Sub Public Property Id() As Integer Get Return _id End Get Set(ByVal value As Integer) If (_id <> value) Then _id = value SetDirtyFlag() End If End Set End Property Public Property Text() As String Get Return _text End Get Set(ByVal Value As String) If (_text <> Value) Then _text = Value SetDirtyFlag() End If End Set End Property Public Property C() As C Get 'Retrieving manually when we have an association set to autoretrieve can produce 'unpredictable results. 'If _c Is Nothing AndAlso _cOID <> String.Empty Then ' _c = New C ' _c.OIDValue = _cOID ' _c.Retrieve() 'End If Return _c End Get Set(ByVal Value As C) If Me._c Is Nothing AndAlso Not (Value Is Nothing) Then Me._c = Value Me._cOID = Value.OIDValue Else If Value Is Nothing Then Me._c = Nothing Me._cOID = Nothing Else If Not Me._c.Equals(Value) Then Me._c = Value Me._cOID = Value.OIDValue End If End If End If Me.SetDirtyFlag() End Set End Property Public Property COID() As String Get If Not _c Is Nothing Then Return _c.OIDValue Else Return _cOID End If End Get Set(ByVal Value As String) _cOID = Value End Set End Property Public Property BCol() As PersistentObjectCollection Get Return _bCol End Get Set(ByVal Value As PersistentObjectCollection) If _bCol.Equals(Value) Then _bCol = Value For Each _b As B In _bCol _b.A = Me Next SetDirtyFlag() End If End Set End Property Public Overrides Function getNewObject() As PersistentObject Return New A End Function Public Overrides Function IsValid() As Boolean Return True End Function Private Sub _bCol_ListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles _bCol.ListChanged Me.SetDirtyFlag() End Sub End Class Public Class B Inherits PersistentObject Public Sub New() _nCol = New PersistentObjectCollection Me.SetDirtyFlag() End Sub Public _id As Integer = 0 Public _text As String = String.Empty Public _a As A = Nothing Public _aOID As String = Nothing Public WithEvents _nCol As PersistentObjectCollection Public Property Id() As Integer Get Return Me._id End Get Set(ByVal Value As Integer) If Not (Me._id = Value) Then Me._id = Value Me.SetDirtyFlag() End If End Set End Property Public Property Text() As String Get Return Me._text End Get Set(ByVal Value As String) If Not (Me._text = Value) Then Me._text = Value Me.SetDirtyFlag() End If End Set End Property Public Property A() As A Get Return Me._a End Get Set(ByVal Value As A) If Me._a Is Nothing AndAlso Not (Value Is Nothing) Then Me._a = Value Me._aOID = Value.OIDValue Else If Value Is Nothing Then Me._a = Nothing Me._aOID = Nothing Else If Not Me._a.Equals(Value) Then Me._a = Value Me._aOID = Value.OIDValue End If End If End If Me.SetDirtyFlag() End Set End Property Public Property AOID() As String Get If Not (Me._a Is Nothing) Then Return Me._a.OIDValue Else Return Me._aOID End If End Get Set(ByVal Value As String) If Not (Me._a Is Nothing) Then If Not (Me._a.OIDValue = Value) Then Me._a.OIDValue = Value Me.SetDirtyFlag() End If End If Me._aOID = Value End Set End Property Public Property NCol() As PersistentObjectCollection Get Return Me._nCol End Get Set(ByVal Value As PersistentObjectCollection) If Me._nCol.Equals(Value) Then Me._nCol = Value For Each _n As N In Me._nCol _n.B = Me Next SetDirtyFlag() End If End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New B End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function Private Sub _nCol_ListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles _nCol.ListChanged Me.SetDirtyFlag() End Sub End Class Public Class C Inherits PersistentObject Public Sub New() End Sub Private _id As Integer = 0 Private _text As String = String.Empty Public Property Id() As Integer Get Return Me._id End Get Set(ByVal Value As Integer) If Not (Me._id = Value) Then Me._id = Value Me.SetDirtyFlag() End If End Set End Property Public Property Text() As String Get Return Me._text End Get Set(ByVal Value As String) If Not (Me._text = Value) Then Me._text = Value Me.SetDirtyFlag() End If End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New C End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class D Inherits B Public Sub New() End Sub Private _str As String = String.Empty Public Property Str() As String Get Return Me._str End Get Set(ByVal Value As String) If Not (Me._str = Value) Then Me._str = Value Me.SetDirtyFlag() End If End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New D End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class E Inherits B Public Sub New() End Sub Private _str As String = String.Empty Private _m As M = Nothing Private _mOID As String Public Property Str() As String Get Return Me._str End Get Set(ByVal Value As String) If Not (Me._str = Value) Then Me._str = Value Me.SetDirtyFlag() End If End Set End Property Public Property M1() Get Return Me._m End Get Set(ByVal Value) If Me._m Is Nothing AndAlso Not (Value Is Nothing) Then Me._m = Value Me._mOID = Value.OIDValue Else If Value Is Nothing Then Me._m = Nothing Me._mOID = Nothing Else If Not Me._m.Equals(Value) Then Me._m = Value Me._mOID = Value.OIDValue End If End If End If Me.SetDirtyFlag() End Set End Property Public Property M1OID() Get If Not Me._m Is Nothing Then Return Me._m.OIDValue Else Return Me._mOID End If End Get Set(ByVal Value) If Not Me._m Is Nothing Then If Not Me._m.OIDValue.Equals(Value) Then Me._m.OIDValue = Value Me.SetDirtyFlag() End If End If Me._mOID = Value End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New E End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class F Inherits E Public Sub New() End Sub Private _i As Integer = 0 Public Property I() As Integer Get Return Me._i End Get Set(ByVal Value As Integer) If Not (Me._i = Value) Then Me._i = Value Me.SetDirtyFlag() End If End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New F End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class G Inherits E Public Sub New() End Sub Private _i As Integer = 0 Private _m As M = Nothing Private _mOID As String = Nothing Public Property I() As Integer Get Return Me._i End Get Set(ByVal Value As Integer) If Not (Me._i = Value) Then Me._i = Value Me.SetDirtyFlag() End If End Set End Property Public Property M() Get Return Me._m End Get Set(ByVal Value) If Me._m Is Nothing AndAlso Not (Value Is Nothing) Then Me._m = Value Me._mOID = Value.OIDValue Else If Value Is Nothing Then Me._m = Nothing Me._mOID = Nothing Else If Not Me._m.Equals(Value) Then Me._m = Value Me._mOID = Value.OIDValue End If End If End If Me.SetDirtyFlag() End Set End Property Public Property MOID() Get If Not Me._m Is Nothing Then Return Me._m.OIDValue Else Return Me._mOID End If End Get Set(ByVal Value) If Not Me._m Is Nothing Then If Not Me._m.OIDValue.Equals(Value) Then Me._m.OIDValue = Value Me.SetDirtyFlag() End If End If Me._mOID = Value End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New G End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class H Inherits C Public Sub New() End Sub Private _str As String = String.Empty Private _m As M = Nothing Private _mOID As String Public Property Str() As String Get Return Me._str End Get Set(ByVal Value As String) If Not (Me._str = Value) Then Me._str = Value Me.SetDirtyFlag() End If End Set End Property Public Property M1() Get Return Me._m End Get Set(ByVal Value) If Me._m Is Nothing AndAlso Not (Value Is Nothing) Then Me._m = Value Me._mOID = Value.OIDValue Else If Value Is Nothing Then Me._m = Nothing Me._mOID = Nothing Else If Not Me._m.Equals(Value) Then Me._m = Value Me._mOID = Value.OIDValue End If End If End If Me.SetDirtyFlag() End Set End Property Public Property M1OID() Get If Not Me._m Is Nothing Then Return Me._m.OIDValue Else Return Me._mOID End If End Get Set(ByVal Value) If Not Me._m Is Nothing Then If Not Me._m.OIDValue.Equals(Value) Then Me._m.OIDValue = Value Me.SetDirtyFlag() End If End If Me._mOID = Value End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New H End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class I Inherits C Public Sub New() End Sub Private _str As String = String.Empty Public Property Str() As String Get Return Me._str End Get Set(ByVal Value As String) If Not (Me._str = Value) Then Me._str = Value Me.SetDirtyFlag() End If End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New I End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class J Inherits H Public Sub New() End Sub Private _i As Integer = 0 Public Property I() As Integer Get Return Me._i End Get Set(ByVal Value As Integer) If Not (Me._i = Value) Then Me._i = Value Me.SetDirtyFlag() End If End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New J End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class K Inherits H Public Sub New() End Sub Private _i As Integer = 0 Private _m As M = Nothing Private _mOID As String Public Property I() As Integer Get Return Me._i End Get Set(ByVal Value As Integer) If Not (Me._i = Value) Then Me._i = Value Me.SetDirtyFlag() End If End Set End Property Public Property M() Get Return Me._m End Get Set(ByVal Value) If Me._m Is Nothing AndAlso Not (Value Is Nothing) Then Me._m = Value Me._mOID = Value.OIDValue Else If Value Is Nothing Then Me._m = Nothing Me._mOID = Nothing Else If Not Me._m.Equals(Value) Then Me._m = Value Me._mOID = Value.OIDValue End If End If End If Me.SetDirtyFlag() End Set End Property Public Property MOID() Get If Not Me._m Is Nothing Then Return Me._m.OIDValue Else Return Me._mOID End If End Get Set(ByVal Value) If Not Me._m Is Nothing Then If Not Me._m.OIDValue.Equals(Value) Then Me._m.OIDValue = Value Me.SetDirtyFlag() End If End If Me._mOID = Value End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New K End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class M Inherits PersistentObject Public Sub New() End Sub Private _i As Integer = 0 Public Property I() As Integer Get Return Me._i End Get Set(ByVal Value As Integer) If Not (Me._i = Value) Then Me._i = Value Me.SetDirtyFlag() End If End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New M End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class Public Class N Inherits PersistentObject Public Sub New() End Sub Private _i As Integer = 0 Private _b As B = Nothing Private _bOID As String = Nothing Public Property I() As Integer Get Return Me._i End Get Set(ByVal Value As Integer) If Not (Me._i = Value) Then Me._i = Value Me.SetDirtyFlag() End If End Set End Property Public Property B() As B Get Return Me._b End Get Set(ByVal Value As B) If Me._b Is Nothing AndAlso Not (Value Is Nothing) Then Me._b = Value Me._bOID = Value.OIDValue Else If Value Is Nothing Then Me._b = Nothing Me._bOID = Nothing Else If Not Me._b.Equals(Value) Then Me._b = Value Me._bOID = Value.OIDValue End If End If End If Me.SetDirtyFlag() End Set End Property Public Property BOID() As String Get If Not (Me._b Is Nothing) Then Return Me._b.OIDValue Else Return Me._bOID End If End Get Set(ByVal Value As String) If Not (Me._b Is Nothing) Then If Not (Me._b.OIDValue = Value) Then Me._b.OIDValue = Value Me.SetDirtyFlag() End If End If Me._bOID = Value End Set End Property Public Overloads Overrides Function getNewObject() As PersistentObject Return New N End Function Public Overloads Overrides Function IsValid() As Boolean Return True End Function End Class End Namespace --- NEW FILE: SharedTests.vb --- Imports AtomsFramework Imports NUnit.Framework Namespace InheritedClasses <TestFixture()> Public Class SharedTests Private pbroker As PersistenceBroker Dim sc As SharedChild Dim sp As SharedParent <TestFixtureSetUp()> Public Sub Init() Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory Dim retry As Boolean = True While retry = True Try 'Remove any existing test database System.IO.File.Delete(".\db1.mdb") retry = False Catch iox As IO.IOException 'file is in use - so we will loop around until it is released GC.Collect() Catch ex As Exception retry = False End Try End While System.IO.File.Copy(".\original db1.mdb", ".\db1.mdb") pbroker = New PersistenceBroker pbroker.init() End Sub <TestFixtureTearDown()> Public Sub Dispose() pbroker.Dispose() pbroker = Nothing End Sub <SetUp()> Public Sub testInit() sc = New SharedChild sp = New SharedParent End Sub <Test()> Public Sub SaveAndRetrieveSharedChild() Dim result As Boolean Dim origOid As String = String.Empty Dim newOid As String = String.Empty sc.IsDirty = True sc.Field1 = "a" sc.Field2 = "b" sc.Save() origOid = sc.OIDValue sc = New SharedChild newOid = sc.OIDValue sc.OIDValue = origOid result = sc.Retrieve() Assert.IsTrue(sc.OIDValue = origOid) Assert.IsTrue(origOid <> newOid) Assert.IsTrue(result) Assert.IsFalse(sc.IsDirty) sc.IsDirty = True sc.Save() End Sub <Test()> Public Sub SaveChildAndRetrieveParent() Dim result As Boolean Dim origOid As String = String.Empty sc.IsDirty = True sc.Field1 = "xx" sc.Field2 = "yy" sc.Save() origOid = sc.OIDValue sp.OIDValue = origOid result = sp.Retrieve() Assert.IsTrue(sp.OIDValue = origOid) Assert.AreEqual("xx", sp.Field1) Assert.IsTrue(result) Assert.IsFalse(sp.IsDirty) Assert.IsFalse(sp.GetType Is GetType(SharedChild)) End Sub End Class End Namespace --- NEW FILE: ManyToManyTests_v2.vb --- Imports AtomsFramework Imports NUnit.Framework Namespace InheritedClasses <TestFixture()> Public Class ManyToManyTests_v2 Private pbroker As PersistenceBroker Private A As M2MA Private B As M2MB <TestFixtureSetUp()> Public Sub Init() Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory Dim retry As Boolean = True While retry = True Try 'Remove any existing test database System.IO.File.Delete(".\db1.mdb") retry = False Catch iox As IO.IOException 'file is in use - so we will loop around until it is released GC.Collect() Catch ex As Exception retry = False End Try End While System.IO.File.Copy(".\original db1.mdb", ".\db1.mdb") pbroker = New PersistenceBroker pbroker.init() End Sub <TestFixtureTearDown()> Public Sub Dispose() pbroker.Dispose() pbroker = Nothing End Sub <Test()> Public Sub SaveThenRetrieve() Dim gval As String Dim x As Integer, y As Integer A = New M2MA A.Description = "A-one" gval = A.GUIDValue B = New M2MB B.Description = "B-one" A.M2MBCollection.Add(B) B.M2MACollection.Add(A) Dim B2 As M2MB = New M2MB B2.Description = "B-two" A.M2MBCollection.Add(B2) Dim A2 As M2MA = New M2MA A2.Description = "A-two" B2.M2MACollection.Add(A2) A.Save() pbroker.ClearCache() A = New M2MA A.GUIDValue = gval A.Retrieve() Assert.AreEqual(2, A.M2MBCollection.Count) 'Order of guids can affect order of the collection If A.M2MBCollection.Item(... [truncated message content] |
From: Richard B. <rb...@us...> - 2005-04-11 00:28:51
|
Update of /cvsroot/jcframework/dotnet/Nunit/InheritedClasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32215/InheritedClasses Log Message: Directory /cvsroot/jcframework/dotnet/Nunit/InheritedClasses added to the repository |
From: Richard B. <rb...@us...> - 2005-04-11 00:28:44
|
Update of /cvsroot/jcframework/dotnet/Nunit/StandardClasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32215/StandardClasses Log Message: Directory /cvsroot/jcframework/dotnet/Nunit/StandardClasses added to the repository |
From: Richard B. <rb...@us...> - 2005-04-11 00:28:44
|
Update of /cvsroot/jcframework/dotnet/Nunit/Interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32215/Interfaces Log Message: Directory /cvsroot/jcframework/dotnet/Nunit/Interfaces added to the repository |
From: Richard B. <rb...@us...> - 2005-04-11 00:28:31
|
Update of /cvsroot/jcframework/dotnet/Nunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32081/Nunit Log Message: Directory /cvsroot/jcframework/dotnet/Nunit added to the repository |
From: Richard B. <rb...@us...> - 2005-04-11 00:28:14
|
Update of /cvsroot/jcframework/dotnet/FxCop In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32081/FxCop Log Message: Directory /cvsroot/jcframework/dotnet/FxCop added to the repository |
From: Richard B. <rb...@us...> - 2005-04-07 07:08:30
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5117 Modified Files: CClassMap.vb CInjectedObject.vb CPersistenceBroker.vb CPersistentObject.vb Log Message: Fix for one-to-many association cleanup when associations belong to the superclass Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.106 retrieving revision 1.107 diff -u -d -r1.106 -r1.107 --- CPersistenceBroker.vb 6 Apr 2005 06:34:20 -0000 1.106 +++ CPersistenceBroker.vb 7 Apr 2005 07:08:16 -0000 1.107 @@ -417,7 +417,9 @@ End While obj.IsProxy = False 'Need to set non-proxy in case object is loaded via a retrieve criteria If Not obj.IsIPersistentObject Then - obj = LocateOrCacheInjObject(obj, False, True) + 'We need to ensure the object is in the injection cache, but we don't + 'want to replace obj's values if it is already there (ie don't use the return value) + Call LocateOrCacheInjObject(obj, False, True) End If m_cache.Add(obj) 'Add retrieved object to the cache Try @@ -2933,10 +2935,39 @@ obj = injObj.GetSourceObject End Sub + ''' ----------------------------------------------------------------------------- + ''' <summary> + ''' Finds an object in the database using the Find attributes. + ''' </summary> + ''' <param name="obj">The object to be found.</param> + ''' <remarks>Do not pass an object that inherits from the CPersistentObject. For those + ''' objects use the inbuilt Find() method.</br> + ''' This method will use the cache to assist in locating the object. If nothing + ''' is found the object will remain unchanged. + ''' </remarks> + ''' <history> + ''' [rbanks] 7/04/2005 Created + ''' </history> + ''' ----------------------------------------------------------------------------- Public Sub FindObject(ByRef obj As Object) FindObject(obj, True) End Sub + ''' ----------------------------------------------------------------------------- + ''' <summary> + ''' Finds an object in the database using the Find attributes. + ''' </summary> + ''' <param name="obj">The object to be found</param> + ''' <param name="useCache">Indicates wether the cache should be searched</param> + ''' <remarks>Do not pass an object that inherits from the CPersistentObject. For those + ''' objects use the inbuilt Find() method.</br> + ''' This method will optionally use the cache to assist in locating the object. If nothing + ''' is found the object will remain unchanged. + ''' </remarks> + ''' <history> + ''' [rbanks] 7/04/2005 Created + ''' </history> + ''' ----------------------------------------------------------------------------- Public Sub FindObject(ByRef obj As Object, ByVal useCache As Boolean) Dim needToAdd As Boolean = False Dim injObj As CInjectedObject @@ -2956,22 +2987,6 @@ Return LocateOrCacheInjObject(obj, True, createTemporary) End Function - 'Public Function getInjectedObject(ByVal obj As Object, ByVal createTemporary As Boolean) As CInjectedObject - ' Dim injObj As CInjectedObject - ' injObj = m_injectedObjects.Find(obj) - ' If injObj Is Nothing Then - ' injObj = New CInjectedObject(obj) - ' If createTemporary Then - ' 'When a single injected object has a reference to a set of objects that are - ' 'recursively referencing each other we need to add the objects to the cache - ' 'in order to prevent nested recursion. This temporary addition is only - ' 'used in getObjectsToSave - ' m_injectedObjects.AddTemp(injObj, False) - ' End If - ' End If - ' Return injObj - 'End Function - Public Function LocateOrCacheInjObject(ByVal obj As Object, ByVal replaceCachedValues As Boolean, ByVal addToCache As Boolean) As CInjectedObject Dim injObj As CInjectedObject injObj = m_injectedObjects.Find(obj) @@ -2999,16 +3014,6 @@ Return injObj End Function - 'Public Sub StartTracking(ByVal obj As Object) - ' If Not TypeOf (obj) Is CInjectedObject Then - ' Dim injObj As CInjectedObject - ' injObj = New CInjectedObject(obj) - ' m_injectedObjects.Add(injObj) - ' Else - ' m_injectedObjects.Add(obj) - ' End If - 'End Sub - Public Function ObjectIsTracked(ByVal obj) As Boolean Debug.WriteLine(m_injectedObjects) Return m_injectedObjects.isTracked(obj) @@ -3283,7 +3288,7 @@ End Sub Public Shared Sub CopyCollections(ByVal fromObject As Object, ByRef toObject As Object) - Dim t, iEnumerableType, iListType, iDicType As Type + Dim t, t1, iEnumerableType, iListType, iDicType As Type Dim fromColl, toColl, collItem As Object Dim il As IList Dim id As IDictionary @@ -3291,6 +3296,7 @@ Dim value As Object t = toObject.GetType + While Not t Is Nothing fields = t.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) For Each f In fields iListType = f.FieldType.GetInterface("IList", True) @@ -3309,16 +3315,16 @@ fromColl = f.GetValue(fromObject) If Not fromColl Is Nothing Then 'If the field doesn't support the ICloneable interface then just set it. - t = f.FieldType - toColl = Activator.CreateInstance(t) + t1 = f.FieldType + toColl = Activator.CreateInstance(t1) 'need to copy references one-by-one 'Also neeed to connect event handlers of new collection to new object based 'on event connections of the old collection and the old object Dim fColl, fieldsColl() As FieldInfo Dim d, newD, delArray(), newDelArray() As [Delegate] Dim collDel As MulticastDelegate - While Not t Is Nothing - fieldsColl = t.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) + While Not t1 Is Nothing + fieldsColl = t1.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) For Each fColl In fieldsColl If fColl.FieldType.Name = fColl.Name & "Handler" OrElse fColl.FieldType Is GetType(EventHandler) Then 'This is an event! @@ -3342,10 +3348,10 @@ End If End If Next - If t.IsSubclassOf(GetType(CPersistentCollection)) Then - t = t.BaseType + If t1.IsSubclassOf(GetType(CPersistentCollection)) Then + t1 = t1.BaseType Else - t = Nothing + t1 = Nothing End If End While If Not iListType Is Nothing Then @@ -3373,6 +3379,13 @@ f.SetValue(toObject, toColl) End If Next + 'Need to make sure collections in base types are also copied + If Not t.BaseType Is Nothing Then + t = t.BaseType + Else + t = Nothing + End If + End While End Sub ''' ----------------------------------------------------------------------------- Index: CInjectedObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- CInjectedObject.vb 6 Apr 2005 06:34:20 -0000 1.24 +++ CInjectedObject.vb 7 Apr 2005 07:08:16 -0000 1.25 @@ -662,6 +662,7 @@ cm = Me.getClassMap m_oneToManyCollections = New Collection Dim aMap As CUDAMap + While Not cm Is Nothing For Each de As DictionaryEntry In cm.AssociationMaps aMap = de.Value If aMap.Cardinality = aMap.CardinalityEnum.ONE_TO_MANY Then @@ -669,6 +670,8 @@ m_oneToManyCollections.Add(coll, aMap.FromClassTarget) End If Next + cm = cm.SuperClass + End While End Sub Public Function GetRemovedCollectionItems(ByVal propertyName As String) As Collection Implements IPersistableObject.GetRemovedCollectionItems Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- CPersistentObject.vb 6 Apr 2005 06:34:20 -0000 1.64 +++ CPersistentObject.vb 7 Apr 2005 07:08:18 -0000 1.65 @@ -1753,6 +1753,7 @@ cm = Me.getClassMap m_oneToManyCollections = New Collection Dim aMap As CUDAMap + While Not cm Is Nothing For Each de As DictionaryEntry In cm.AssociationMaps aMap = de.Value If aMap.Cardinality = aMap.CardinalityEnum.ONE_TO_MANY Then @@ -1760,6 +1761,8 @@ m_oneToManyCollections.Add(coll, aMap.FromClassTarget) End If Next + cm = cm.SuperClass + End While End Sub Public Function GetRemovedCollectionItems(ByVal propertyName As String) As Collection Implements IPersistableObject.GetRemovedCollectionItems Index: CClassMap.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CClassMap.vb,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- CClassMap.vb 1 Apr 2005 00:03:53 -0000 1.56 +++ CClassMap.vb 7 Apr 2005 07:08:15 -0000 1.57 @@ -2168,7 +2168,7 @@ Try If ClassNameSpace = String.Empty Then For Each tt As Type In asm.GetTypes() - If tt.Name = Name Then + If tt.Name = Name or tt.fullname = name Then t = tt Exit For End If |
From: Richard B. <rb...@us...> - 2005-04-06 07:23:31
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6151 Modified Files: userguide.sh5 Log Message: Updated user guide - more structural stuff (no more content yet) Index: userguide.sh5 =================================================================== RCS file: /cvsroot/jcframework/dotnet/userguide.sh5,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 Binary files /tmp/cvsvPdyL9 and /tmp/cvsrKWZ9b differ |
From: Richard B. <rb...@us...> - 2005-04-06 06:35:00
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386 Modified Files: AssemblyInfo.vb CCriteriaCondition.vb CInjectedObject.vb CPersistenceBroker.vb CPersistentObject.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: CCriteriaCondition.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CCriteriaCondition.vb,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- CCriteriaCondition.vb 1 Apr 2005 00:04:06 -0000 1.19 +++ CCriteriaCondition.vb 6 Apr 2005 06:34:20 -0000 1.20 @@ -159,7 +159,6 @@ MyBase.New() m_Simple = True m_Parts = New Collection - m_parent = Nothing End Sub '''----------------------------------------------------------------------------- @@ -190,6 +189,9 @@ ''' </history> ''' ----------------------------------------------------------------------------- Public Sub addSubCriteria(ByVal subCriteria As CCriteriaCondition, ByVal useOr As Boolean) + If subCriteria Is Nothing Then + Exit Sub + End If m_Simple = False If subCriteria.ClassMap Is Nothing Then subCriteria.ClassMap = Me.ClassMap @@ -278,7 +280,7 @@ '''----------------------------------------------------------------------------- Private Sub SetCriteriaParams(ByVal attributeName As String, ByRef selCri As CSelectionCriteria, ByRef ValueA As Object, ByRef ValueB As Object, ByVal tblAlias As String) Dim AttrMap As CAttributeMap - Dim myArrayStrings As Object + Dim myArrayStrings() As String myArrayStrings = Split(attributeName, ".", -1, CompareMethod.Text) Dim clMap As CClassMap clMap = m_classMap @@ -677,6 +679,9 @@ ''' </history> '''----------------------------------------------------------------------------- Public Sub fillStatement(ByRef statement As CSqlStatement) + If statement Is Nothing Then + Exit Sub + End If If Not m_Simple Then statement.addSqlClause("(") End If Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- CPersistenceBroker.vb 4 Apr 2005 23:49:43 -0000 1.105 +++ CPersistenceBroker.vb 6 Apr 2005 06:34:20 -0000 1.106 @@ -1228,10 +1228,13 @@ cm = clMap If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then + Try If Not CType(obj.GetSourceObject, IValidation).IsValidToDelete Then - Debug.WriteLine("Not valid to delete object") - Return 'Do not delete if object + Throw New DeleteException("Delete Validation Failed for " & obj.GetObjectType.FullName & vbCrLf & "No further information available") End If + Catch ex As Exception + Throw New DeleteException("Delete Validation Failed" & obj.GetObjectType.FullName & vbCrLf & ex.Message) + End Try End If Debug.WriteLine("Deleting object " & cm.Name) @@ -2600,6 +2603,7 @@ Dim col As IList 'Dim stack As New Stack Dim q As New Queue + Dim resultQueue As Queue Dim i, k As Integer Dim tmpObj As Object Dim injObj As IPersistableObject @@ -2629,7 +2633,13 @@ End If If obj.IsProxy Then Return q 'Do not save if object is proxied If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then - If Not CType(obj.GetSourceObject, IValidation).IsValid Then Return q 'Do not save if object is not valid + Try + If Not CType(obj.GetSourceObject, IValidation).IsValid Then + Throw New SaveException("Save Validation Failed for " & obj.GetObjectType.FullName & vbCrLf & "No further information available") + End If + Catch ex As Exception + Throw New SaveException("Save Validation Failed for " & obj.GetObjectType.FullName & vbCrLf & ex.Message) + End Try End If If obj.IsReadOnly Then Return q @@ -2649,9 +2659,15 @@ If includeBaseObject AndAlso _ (obj.IsDirty AndAlso Not obj.IsProxy AndAlso Not obj.IsReadOnly AndAlso Not obj.IsModifyOnly) Then If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then + Try If CType(obj.GetSourceObject, IValidation).IsValid Then 'Do not save if object is not valid AddToQueue(obj, q) + Else + Throw New SaveException("Save Validation Failed for " & obj.GetObjectType.FullName & vbCrLf & "No further information available") End If + Catch ex As Exception + Throw New SaveException("Save Validation Failed for " & obj.GetObjectType.FullName & vbCrLf & ex.Message) + End Try Else AddToQueue(obj, q) End If @@ -2673,9 +2689,11 @@ Else value = injObj End If - For Each o In getObjectsToSave(value, True, checkAssociationsRecursivly) - q.Enqueue(o) - Next + resultQueue = getObjectsToSave(value, True, checkAssociationsRecursivly) + Do While resultQueue.Count > 0 + qObj = resultQueue.Dequeue + q.Enqueue(qObj) + Loop End If ElseIf udamap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_MANY Then col = obj.GetCollectionByAttribute(udamap.FromClassTarget) @@ -2687,9 +2705,11 @@ Else value = tmpObj End If - For Each o In getObjectsToSave(value, True, checkAssociationsRecursivly) - q.Enqueue(o) - Next + resultQueue = getObjectsToSave(value, True, checkAssociationsRecursivly) + Do While resultQueue.Count > 0 + qObj = resultQueue.Dequeue + q.Enqueue(qObj) + Loop Next k End If 'Now go through and find out which objects have been removed from the collection @@ -2738,9 +2758,11 @@ End If aObj = Nothing isNewManyToMany = state.ValidateObject(value) - For Each qObj In getObjectsToSave(value, True, checkAssociationsRecursivly) + resultQueue = getObjectsToSave(value, True, checkAssociationsRecursivly) + Do While resultQueue.Count > 0 + qObj = resultQueue.Dequeue q.Enqueue(qObj) - Next + Loop If isNewManyToMany Then 'We need to create an association object here for the class. aObj = New CAssociationObject @@ -2759,6 +2781,13 @@ cm = cm.SuperClass End While + If Not obj.IsDirty And q.Count > 0 Then + 'This object isn't dirty and won't be saved. The queue length is non-zero which + 'indicates that associations have changed. + 'Because the object won't be saved it won't be updated in the cache, so we'll + 'do it here to make sure the cache version has the updated associations. + m_cache.Add(obj) + End If Return q End Function @@ -3079,6 +3108,7 @@ m_objectsToDelete.Clear() End If Else + Try q = getObjectsToSave(injObj, True, checkAssociationsRecursively) 'All objects to be saved must be saved in a single transaction. If q.Count > 0 Then @@ -3126,6 +3156,17 @@ Loop commit() End If + Catch sx As SaveException + If Not m_inPersistChangesLoop Then + m_injectedObjects.CleanUp() + End If + Throw sx + Catch ex As Exception + If Not m_inPersistChangesLoop Then + m_injectedObjects.CleanUp() + End If + Throw New SaveException("Persist Changes Failed" & vbCrLf & ex.Message) + End Try End If If Not m_inPersistChangesLoop Then m_injectedObjects.CleanUp() Index: CInjectedObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- CInjectedObject.vb 4 Apr 2005 23:49:42 -0000 1.23 +++ CInjectedObject.vb 6 Apr 2005 06:34:20 -0000 1.24 @@ -398,7 +398,7 @@ Private Function getObjectByAttribute(ByVal srcObj As Object, ByVal pName As String) As IPersistableObject Dim dotPos As Integer Dim obj As Object - Dim injobj As CInjectedObject + Dim injobj As IPersistableObject Dim pbroker As CPersistenceBroker dotPos = pName.IndexOf(".") @@ -682,19 +682,23 @@ Dim injObj As IPersistableObject Try - origColl = m_oneToManyCollections.Item(propertyName) + If m_oneToManyCollections.Count = 0 Then + origColl = Nothing + Else + origColl = m_oneToManyCollections.Item(PropertyName) + End If Catch origColl = Nothing End Try If origColl Is Nothing Then Return toColl - p = Me.GetObjectType.GetProperty(propertyName, BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) + p = Me.GetObjectType.GetProperty(PropertyName, BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) iListType = p.PropertyType.GetInterface("IList", True) iDicType = p.PropertyType.GetInterface("IDictionary", True) If Not iListType Is Nothing OrElse Not iDicType Is Nothing Then If Not iListType Is Nothing Then origIList = CType(origColl, IList) - fromIList = CType(Me.getValueByAttribute(propertyName), IList) + fromIList = CType(Me.getValueByAttribute(PropertyName), IList) For Each collItem In origIList If NotInCollection(fromIList, collItem) Then If Not TypeOf collItem Is IPersistableObject Then @@ -707,7 +711,7 @@ Next Else origDict = CType(origColl, IDictionary) - fromDict = CType(Me.getValueByAttribute(propertyName), IDictionary) + fromDict = CType(Me.getValueByAttribute(PropertyName), IDictionary) For Each de As DictionaryEntry In origColl If NotInCollection(fromDict, de.Key) Then If Not TypeOf collItem Is IPersistableObject Then Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- CPersistentObject.vb 4 Apr 2005 23:49:43 -0000 1.63 +++ CPersistentObject.vb 6 Apr 2005 06:34:20 -0000 1.64 @@ -925,8 +925,8 @@ Dim ckey As CCacheKey persistentBroker = getPersistenceBrokerInstance() + Try queue = persistentBroker.getObjectsToSave(obj, True, checkAssociationsRecursivly) - 'All objects to be saved must be saved in a single transaction. If queue.Count > 0 Then persistentBroker.startTransaction() @@ -970,6 +970,11 @@ Loop persistentBroker.commit() End If + Catch sx As SaveException + Throw sx + Catch ex As Exception + Throw New SaveException("Save Failed" & vbCrLf & ex.Message) + End Try End Sub '''----------------------------------------------------------------------------- Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/AssemblyInfo.vb,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- AssemblyInfo.vb 23 Dec 2004 01:14:44 -0000 1.14 +++ AssemblyInfo.vb 6 Apr 2005 06:34:20 -0000 1.15 @@ -13,6 +13,8 @@ <Assembly: AssemblyTrademark("")> <Assembly: AssemblyCulture("")> <Assembly: AssemblyKeyFile("..\..\AtomsFramework.snk")> +<Assembly: CLSCompliant(True)> +<Assembly: System.Runtime.InteropServices.ComVisible(False)> ' Version information for an assembly consists of the following four values: @@ -26,6 +28,7 @@ <Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.1")> ''' ----------------------------------------------------------------------------- ''' Project : AToMSFramework |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:31
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_PostgreSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_PostgreSQL Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_PostgreSQL/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 23:09:32 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:23 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:31
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_OLEDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_OLEDB Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_OLEDB/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 07:37:54 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:22 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:30
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_MySQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_MySQL Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_MySQL/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 07:37:37 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:22 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:30
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_ODBC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_ODBC Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_ODBC/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 07:37:53 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:22 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:30
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_MaxDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_MaxDB Modified Files: AssemblyInfo.vb CMaxDBDatabase.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: CMaxDBDatabase.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_MaxDB/CMaxDBDatabase.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CMaxDBDatabase.vb 7 Feb 2005 07:37:37 -0000 1.1 +++ CMaxDBDatabase.vb 6 Apr 2005 06:34:22 -0000 1.2 @@ -25,4 +25,8 @@ Public Overrides Function useBracketsForJoins() As Boolean Return False End Function + + Public Overrides Function getClauseStringLimit() As String + Return "and rowno <=" + End Function End Class \ No newline at end of file Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_MaxDB/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 07:37:37 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:22 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:30
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_MSSQL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_MSSQL Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_MSSQL/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 07:37:36 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:22 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:29
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_MSOracle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_MSOracle Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_MSOracle/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 07:37:36 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:21 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:29
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_Informix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_Informix Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_Informix/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 07:37:36 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:21 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:34:29
|
Update of /cvsroot/jcframework/dotnet/Providers/AF_Firebird In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25386/Providers/AF_Firebird Modified Files: AssemblyInfo.vb Log Message: Fix for type mismatch error in GetObjectsToSave Handle exceptions thrown by user classes when performing object IValidation checks Add Assembly versioning to Providers Add AssemblyFileVersion to framework. Index: AssemblyInfo.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/Providers/AF_Firebird/AssemblyInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AssemblyInfo.vb 7 Feb 2005 23:29:48 -0000 1.1 +++ AssemblyInfo.vb 6 Apr 2005 06:34:21 -0000 1.2 @@ -29,4 +29,5 @@ ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: -<Assembly: AssemblyVersion("1.0.*")> +<Assembly: AssemblyVersion("2.1.0.0")> +<Assembly: AssemblyFileVersion("2.1.0.0")> |
From: Richard B. <rb...@us...> - 2005-04-06 06:32:56
|
Update of /cvsroot/jcframework/Nunit/Interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25158/Interfaces Modified Files: EmployeeInterfaceTests.vb Log Message: Catch exceptions in unit tests when objects aren't valid Index: EmployeeInterfaceTests.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/Interfaces/EmployeeInterfaceTests.vb,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- EmployeeInterfaceTests.vb 3 Mar 2005 00:37:25 -0000 1.6 +++ EmployeeInterfaceTests.vb 6 Apr 2005 06:32:47 -0000 1.7 @@ -6,6 +6,7 @@ Private pbroker As CPersistenceBroker Private emp As IEmployee + Private eventcount As Integer = 0 <TestFixtureSetUp()> Public Sub Init() Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory @@ -73,7 +74,11 @@ emp.Name = "invalid" pbroker.FindObject(emp) Assert.IsFalse(pbroker.getInjectedObject(emp).Persistent) + Try pbroker.PersistChanges(emp) + Assert.Fail("Didn't throw the exception") + Catch + End Try Assert.IsFalse(pbroker.getInjectedObject(emp).Persistent) Assert.IsTrue(emp.ReportsTo Is Nothing) End Sub @@ -101,7 +106,11 @@ pbroker.PersistChanges(emp2) emp2.AllowValidation = False pbroker.MarkForDeletion(emp2) + Try pbroker.PersistChanges() + Assert.Fail("Didn't throw an exception") + Catch + End Try pbroker.ClearCache() emp2 = New ValidatedEmployee emp2.Name = "validCheck" @@ -122,5 +131,104 @@ Assert.IsTrue(pbroker.getInjectedObject(emp).Persistent, "persistent check failed") End Sub + '<Test(), Ignore("Not yet ready")> Public Sub CheckEvents() + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' eventcount = 0 + ' emp.Name = "Events" + ' Assert.AreEqual(1, eventcount) + ' pbroker.FindObject(emp) + ' pbroker.PersistChanges(emp) + ' emp = New EmployeeClass + ' emp.Name = "Events" + ' pbroker.FindObject(emp) + ' 'Should not have any events from the previous handler still firing + ' eventcount = 0 + ' emp.Name = "New Name 1" + ' Assert.AreEqual(0, eventcount) + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' emp.Name = "New Name 2" + ' Assert.AreEqual(1, eventcount) + 'End Sub + + '<Test(), Ignore("Not yet ready")> Public Sub CheckEvents2() + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' eventcount = 0 + ' emp.Name = "Events2" + ' Assert.AreEqual(1, eventcount) + ' pbroker.FindObject(emp) + ' pbroker.PersistChanges(emp) + ' emp = New EmployeeClass + ' eventcount = 0 + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' emp.Name = "Events2" + ' Assert.AreEqual(1, eventcount) + ' 'Should retain the event handlers + ' pbroker.FindObject(emp) + ' emp.Name = "Events2a" + ' Assert.AreEqual(2, eventcount) + 'End Sub + + '<Test(), Ignore("Not yet ready")> Public Sub CheckEvents3() + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' eventcount = 0 + ' emp.Name = "Events3" + ' Assert.AreEqual(1, eventcount) + ' pbroker.FindObject(emp) + ' pbroker.PersistChanges(emp) + ' pbroker.ClearCache() + ' emp = New EmployeeClass + ' eventcount = 0 + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' emp.Name = "Events3" + ' Assert.AreEqual(1, eventcount) + ' 'Event should fire when property is set during retrieve + ' pbroker.FindObject(emp) + ' Assert.AreEqual(2, eventcount) + ' 'Check event is still wired up after find completes + ' emp.Name = "Events3a" + ' Assert.AreEqual(3, eventcount) + 'End Sub + + '<Test(), Ignore("Not yet ready")> Public Sub CheckEvents4() + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' eventcount = 0 + ' emp.Name = "Events4" + ' Assert.AreEqual(1, eventcount) + ' pbroker.FindObject(emp) + ' pbroker.PersistChanges(emp) + ' emp = New EmployeeClass + ' emp.Name = "Events4" + ' pbroker.FindObject(emp) + ' 'Should not have any events from the previous handler still firing + ' eventcount = 0 + ' emp.Name = "Events4a" + ' Assert.AreEqual(0, eventcount) + ' AddHandler emp.NameChanged, AddressOf NameChanged + ' emp.Name = "Events4b" + ' Assert.AreEqual(1, eventcount) + 'End Sub + + 'Private Sub NameChanged(ByVal sender As Object, ByVal e As System.EventArgs) + ' eventcount += 1 + 'End Sub + + <Test()> Public Sub CacheTest() + 'Check that local object changes don't impact the cache + emp.Name = "Initial2" + pbroker.FindObject(emp) + pbroker.PersistChanges(emp) + pbroker.ClearCache() + emp = New EmployeeClass + emp.Name = "Initial2" + pbroker.FindObject(emp) + 'Change local copy + emp.Name = "Final" + emp = New EmployeeClass + emp.Name = "Initial2" + pbroker.FindObject(emp) + Assert.AreEqual("Initial2", emp.Name) + End Sub + + End Class End Namespace \ No newline at end of file |
From: Richard B. <rb...@us...> - 2005-04-05 00:00:09
|
Update of /cvsroot/jcframework/Nunit/Interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16325/Interfaces Modified Files: IEmployee.vb Log Message: Extra tests for caching objects with event listeners. Index: IEmployee.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/Interfaces/IEmployee.vb,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- IEmployee.vb 25 Oct 2004 07:14:15 -0000 1.2 +++ IEmployee.vb 4 Apr 2005 23:59:52 -0000 1.3 @@ -7,6 +7,7 @@ Property Workers() As ArrayList Property Team() As InheritedClasses.CTeam Property TeamName() As String + Event NameChanged As EventHandler End Interface Public Class EmployeeClass @@ -18,6 +19,7 @@ Private m_children As ArrayList Private m_team As InheritedClasses.CTeam Private m_teamName As String + Public Event NameChanged As EventHandler Implements IEmployee.NameChanged Public Property Name() As String Implements IEmployee.Name Get @@ -25,6 +27,7 @@ End Get Set(ByVal Value As String) m_name = Value + RaiseEvent NameChanged(Me, New System.EventArgs) End Set End Property |
From: Richard B. <rb...@us...> - 2005-04-05 00:00:09
|
Update of /cvsroot/jcframework/Nunit/InheritedClasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16325/InheritedClasses Modified Files: AtomsFrameworkTests.vb Log Message: Extra tests for caching objects with event listeners. Index: AtomsFrameworkTests.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/InheritedClasses/AtomsFrameworkTests.vb,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- AtomsFrameworkTests.vb 1 Apr 2005 00:00:10 -0000 1.16 +++ AtomsFrameworkTests.vb 4 Apr 2005 23:59:52 -0000 1.17 @@ -213,6 +213,24 @@ Assert.IsTrue(emp.Persistent) End Sub + <Test()> Public Sub CacheTest2() + 'Check that local object changes don't impact the cache + emp.Name = "Initial2" + emp.Find() + Assert.IsFalse(emp.Persistent) + emp.Save() + pbroker.ClearCache() + emp = New CEmployee + emp.Name = "Initial2" + emp.Find() + 'Change local copy + emp.Name = "Final" + emp = New CEmployee + emp.Name = "Initial2" + emp.Find() + Assert.AreEqual("Initial2", emp.Name) + End Sub + <Test()> Public Sub AutoDelete() Dim a As New TableA Dim b As New TableB |
From: Richard B. <rb...@us...> - 2005-04-04 23:49:53
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13504 Modified Files: CCursor.vb CInjectedObject.vb CPersistenceBroker.vb CPersistentObject.vb Log Message: Fix when interfaced object has an association with a CPersistentObject. Fix for parent class association retrieval problem. Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- CPersistenceBroker.vb 4 Apr 2005 01:27:20 -0000 1.104 +++ CPersistenceBroker.vb 4 Apr 2005 23:49:43 -0000 1.105 @@ -417,7 +417,7 @@ End While obj.IsProxy = False 'Need to set non-proxy in case object is loaded via a retrieve criteria If Not obj.IsIPersistentObject Then - obj = LocateOrCacheInjObject(obj, False) + obj = LocateOrCacheInjObject(obj, False, True) End If m_cache.Add(obj) 'Add retrieved object to the cache Try @@ -451,7 +451,7 @@ End If If targetobj.Persistent Then If Not targetobj.IsIPersistentObject Then - targetobj = LocateOrCacheInjObject(targetobj, True) + targetobj = LocateOrCacheInjObject(targetobj, True, True) Else tmpObj = m_cache.Item(targetobj) End If @@ -491,7 +491,7 @@ targetobj = Me.createTargetObjectForMultipleInheritance(udamap.ToClass, obj.GetObjectType, obj.GetObjectType.Namespace, rs.ResultSet.Tables(0).Rows(i), joins, conn) If Not targetobj Is Nothing AndAlso targetobj.Persistent Then If Not targetobj.IsIPersistentObject Then - targetobj = LocateOrCacheInjObject(targetobj, True) + targetobj = LocateOrCacheInjObject(targetobj, True, True) Else tmpObj = m_cache.Item(targetobj) End If @@ -531,7 +531,7 @@ cm2.populateObject(cm2, targetobj, rs, mapName) If targetobj.Persistent Then If Not targetobj.IsIPersistentObject Then - targetobj = LocateOrCacheInjObject(targetobj, True) + targetobj = LocateOrCacheInjObject(targetobj, True, True) Else tmpObj = m_cache.Item(targetobj) End If @@ -601,7 +601,7 @@ classMapCount -= 1 'This is because we added one in the beginning of the for loop If Not targetobj Is Nothing AndAlso targetobj.Persistent Then If Not targetobj.IsIPersistentObject Then - targetobj = LocateOrCacheInjObject(targetobj, True) + targetobj = LocateOrCacheInjObject(targetobj, True, True) Else tmpObj = m_cache.Item(targetobj) End If @@ -661,7 +661,7 @@ 'For injected objects we want to work with just one version 'By not checking the persistent cache we can ensure this, and 'we will also be keeping the persistent cache updated - targetobj = LocateOrCacheInjObject(targetobj, True) + targetobj = LocateOrCacheInjObject(targetobj, True, True) tmpObj = Nothing Else tmpObj = m_cache.Item(targetobj) @@ -762,6 +762,7 @@ Dim Value As IPersistableObject Dim ValueObj As Object Dim ValueVar As String + Dim valuesSet As Boolean Dim tmpOIDValue As String Dim gotValue As Boolean Dim found As Boolean @@ -799,13 +800,20 @@ Value = udaMap.ToClass.CreateObjectInstance If Not Value Is Nothing Then 'Loop through fields in the association + valuesSet = False For j = 1 To udaMap.getSize ValueObj = obj.GetValueByAttribute(udaMap.getEntry(j).FromAttrMap.Name) If Not ValueObj Is Nothing Then Value.SetAttributeValue(udaMap.getEntry(j).ToAttrMap.Name, ValueObj) + valuesSet = True End If Next j + If valuesSet Then + If Not Value.IsIPersistentObject Then + anObjPers = LocateOrCacheInjObject(Value, True, True) + Else anObjPers = m_cache.Item(Value) + End If If anObjPers Is Nothing Then found = retrieveObject(Value, False, False) Else @@ -823,11 +831,17 @@ End If End If End If + End If ElseIf udaMap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_MANY Then + valuesSet = False For j = 1 To udaMap.getSize ValueVar = cm.getValueForRelationalDatabase(obj.GetValueByAttribute(udaMap.getEntry(j).FromAttrMap.Name)) + If Not ValueVar Is Nothing Then aCriteria.WhereCondition.addSelectEqualTo(udaMap.getEntry(j).ToAttrMap.Name, ValueVar) + valuesSet = True + End If Next j + If valuesSet Then aCriteria.ReturnFullObjects = Not udaMap.LazyLoad cursor = processCriteria(aCriteria, colCriteriaParameters, conn) col = obj.GetCollectionByAttribute(udaMap.FromClassTarget) @@ -852,10 +866,9 @@ anObjPers.OriginalCacheKey = New CCacheKey(anObjPers) col.Add(anObjPers.GetSourceObject) If Not anObjPers.IsIPersistentObject Then - anObjPers = LocateOrCacheInjObject(anObjPers, True) - Else + anObjPers = LocateOrCacheInjObject(anObjPers, True, True) + End If m_cache.Add(anObjPers) 'Add retrieved objects to the cache - End If Try PCCacheSize.RawValue = m_cache.Count Catch @@ -864,6 +877,7 @@ End While End If End If + End If Next i colCriteriaParameters = Nothing If Not cm.SuperClass Is Nothing Then @@ -891,7 +905,7 @@ ''' [rbanks] 16/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Sub saveObject(ByRef obj As IPersistableObject) + Public Sub saveObject(ByVal obj As IPersistableObject) SyncLock GetType(CPersistenceBroker) Dim inTicks As Long, outTicks As Long inTicks = Now.Ticks @@ -964,7 +978,7 @@ ''' [rbanks] 16/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Private Sub savePrivateObject(ByRef obj As IPersistableObject, ByVal conn As _CConnection) + Private Sub savePrivateObject(ByVal obj As IPersistableObject, ByVal conn As _CConnection) Dim j, i, k As Integer Dim clMap As CClassMap Dim m As Short @@ -2585,7 +2599,7 @@ Dim qObj As Object Dim col As IList 'Dim stack As New Stack - Dim queue As New queue + Dim q As New Queue Dim i, k As Integer Dim tmpObj As Object Dim injObj As IPersistableObject @@ -2596,7 +2610,7 @@ If obj.IsQueued Then 'if an object has already been added to the save queue, there is no need to add 'it again (could result in infinite recursion) - Return queue + Return q End If If includeBaseObject Then @@ -2611,23 +2625,23 @@ 'to this method while processing parent class maps will turn this off. 'Note that parent objects will not be dirty so in this case so we cannot 'do the normal IsDirty check. - If Not obj.IsDirty Then Return queue 'Do not save if nothing changed + If Not obj.IsDirty Then Return q 'Do not save if nothing changed End If - If obj.IsProxy Then Return queue 'Do not save if object is proxied + If obj.IsProxy Then Return q 'Do not save if object is proxied If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then - If Not CType(obj.GetSourceObject, IValidation).IsValid Then Return queue 'Do not save if object is not valid + If Not CType(obj.GetSourceObject, IValidation).IsValid Then Return q 'Do not save if object is not valid End If If obj.IsReadOnly Then - Return queue + Return q End If If (Not obj.Persistent) And obj.IsModifyOnly Then - Return queue + Return q End If If includeBaseObject Then - AddToQueue(obj, queue) + AddToQueue(obj, q) 'Do not return - since we saved this object we also need to check it's associations Else - Return queue + Return q End If Else 'Determine if the object needs saving @@ -2636,10 +2650,10 @@ (obj.IsDirty AndAlso Not obj.IsProxy AndAlso Not obj.IsReadOnly AndAlso Not obj.IsModifyOnly) Then If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then If CType(obj.GetSourceObject, IValidation).IsValid Then 'Do not save if object is not valid - AddToQueue(obj, queue) + AddToQueue(obj, q) End If Else - AddToQueue(obj, queue) + AddToQueue(obj, q) End If End If End If @@ -2660,7 +2674,7 @@ value = injObj End If For Each o In getObjectsToSave(value, True, checkAssociationsRecursivly) - queue.Enqueue(o) + q.Enqueue(o) Next End If ElseIf udamap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_MANY Then @@ -2674,7 +2688,7 @@ value = tmpObj End If For Each o In getObjectsToSave(value, True, checkAssociationsRecursivly) - queue.Enqueue(o) + q.Enqueue(o) Next Next k End If @@ -2685,7 +2699,7 @@ 'Delete the object qd = New CQueuedDelete qd.ObjectToDelete = value - queue.Enqueue(qd) + q.Enqueue(qd) Else For Each e As CUDAMapEntry In udamap.Entries 'Try to set to nothing first. If it fails set the value to NULL alias value @@ -2699,7 +2713,7 @@ End Try Next 'Now add object to list to be saved - queue.Enqueue(value) + q.Enqueue(value) End If Next ElseIf udamap.Cardinality = CUDAMap.CardinalityEnum.MANY_TO_MANY Then @@ -2725,7 +2739,7 @@ aObj = Nothing isNewManyToMany = state.ValidateObject(value) For Each qObj In getObjectsToSave(value, True, checkAssociationsRecursivly) - queue.Enqueue(qObj) + q.Enqueue(qObj) Next If isNewManyToMany Then 'We need to create an association object here for the class. @@ -2733,7 +2747,7 @@ aObj.ObjectA = obj aObj.ObjectB = value aObj.Association = udamap - queue.Enqueue(aObj) + q.Enqueue(aObj) End If Next k 'Remove old association records for items removed from the collection @@ -2745,7 +2759,7 @@ cm = cm.SuperClass End While - Return queue + Return q End Function ''' ----------------------------------------------------------------------------- @@ -2885,7 +2899,7 @@ Public Sub GetObject(ByRef obj As Object, ByVal useCache As Boolean) Dim injObj As CInjectedObject - injObj = LocateOrCacheInjObject(obj, False) + injObj = LocateOrCacheInjObject(obj, False, True) retrieveObject(injObj, False, useCache) obj = injObj.GetSourceObject End Sub @@ -2906,26 +2920,30 @@ End Sub Public Function getInjectedObject(ByVal obj As Object) As CInjectedObject - Return getInjectedObject(obj, False) + Return LocateOrCacheInjObject(obj, False, False) End Function Public Function getInjectedObject(ByVal obj As Object, ByVal createTemporary As Boolean) As CInjectedObject - Dim injObj As CInjectedObject - injObj = m_injectedObjects.Find(obj) - If injObj Is Nothing Then - injObj = New CInjectedObject(obj) - If createTemporary Then - 'When a single injected object has a reference to a set of objects that are - 'recursively referencing each other we need to add the objects to the cache - 'in order to prevent nested recursion. This temporary addition is only - 'used in getObjectsToSave - m_injectedObjects.AddTemp(injObj, False) - End If - End If - Return injObj + Return LocateOrCacheInjObject(obj, True, createTemporary) End Function - Public Function LocateOrCacheInjObject(ByVal obj As Object, ByVal replaceCachedValues As Boolean) As CInjectedObject + 'Public Function getInjectedObject(ByVal obj As Object, ByVal createTemporary As Boolean) As CInjectedObject + ' Dim injObj As CInjectedObject + ' injObj = m_injectedObjects.Find(obj) + ' If injObj Is Nothing Then + ' injObj = New CInjectedObject(obj) + ' If createTemporary Then + ' 'When a single injected object has a reference to a set of objects that are + ' 'recursively referencing each other we need to add the objects to the cache + ' 'in order to prevent nested recursion. This temporary addition is only + ' 'used in getObjectsToSave + ' m_injectedObjects.AddTemp(injObj, False) + ' End If + ' End If + ' Return injObj + 'End Function + + Public Function LocateOrCacheInjObject(ByVal obj As Object, ByVal replaceCachedValues As Boolean, ByVal addToCache As Boolean) As CInjectedObject Dim injObj As CInjectedObject injObj = m_injectedObjects.Find(obj) If injObj Is Nothing Then @@ -2934,7 +2952,9 @@ Else injObj = New CInjectedObject(obj) End If + If addToCache Then m_injectedObjects.Add(injObj) + End If Else If replaceCachedValues And Not injObj.IsLoading Then If TypeOf obj Is IPersistableObject Then @@ -3032,7 +3052,7 @@ Public Sub PersistChanges(ByVal obj As Object, ByVal checkAssociationsRecursively As Boolean) Dim value As IPersistableObject - Dim queue As queue + Dim q As Queue Dim qObject As Object Dim injObj, tmpObj As CInjectedObject Dim ckey As CCacheKey @@ -3048,7 +3068,7 @@ 'If for some reason the object isn't being tracked for changes yet, we will start 'tracking it now. - injObj = LocateOrCacheInjObject(obj, True) + injObj = LocateOrCacheInjObject(obj, True, True) If injObj.MarkedForDeletion Then deleteObject(injObj, injObj.WillDeleteParents) @@ -3059,12 +3079,12 @@ m_objectsToDelete.Clear() End If Else - queue = getObjectsToSave(injObj, True, checkAssociationsRecursively) + q = getObjectsToSave(injObj, True, checkAssociationsRecursively) 'All objects to be saved must be saved in a single transaction. - If queue.Count > 0 Then + If q.Count > 0 Then startTransaction() - Do While queue.Count > 0 - qObject = queue.Dequeue() + Do While q.Count > 0 + qObject = q.Dequeue() Try If GetType(CAssociationObject).IsInstanceOfType(qObject) Then saveAssociationObject(qObject) @@ -3377,10 +3397,10 @@ Return toColl End Function - Private Sub AddToQueue(ByVal obj As IPersistableObject, ByRef queue As Queue) - Call AddToQueue(obj, queue, True) + Private Sub AddToQueue(ByVal obj As IPersistableObject, ByRef q As Queue) + Call AddToQueue(obj, q, True) End Sub - Private Sub AddToQueue(ByVal obj As IPersistableObject, ByRef queue As Queue, ByVal includeObject As Boolean) + Private Sub AddToQueue(ByVal obj As IPersistableObject, ByRef q As Queue, ByVal includeObject As Boolean) 'Called recursively so that objects with superclasses are queued from the 'top most object down. Dim cm As CClassMap @@ -3389,13 +3409,13 @@ If Not cm.SuperClass Is Nothing Then tmpobj = obj.GetObjectByClassMap(cm.SuperClass) If cm.SharedTableField Is Nothing Then - AddToQueue(tmpobj, queue, True) + AddToQueue(tmpobj, q, True) Else - AddToQueue(tmpobj, queue, False) + AddToQueue(tmpobj, q, False) End If End If If includeObject Then - queue.Enqueue(obj) + q.Enqueue(obj) End If Return End Sub @@ -3420,7 +3440,7 @@ If TypeOf obj Is IPersistentObject Then Throw New RetrieveException("The RefreshObject method cannot be used for classes that inherit from CPersistentObject. Use obj.Refresh()") End If - injObj = LocateOrCacheInjObject(obj, False) + injObj = LocateOrCacheInjObject(obj, False, True) injObj.ResetToOriginal() If Not useCache Then retrieveObject(injObj, False, False) Index: CCursor.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CCursor.vb,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- CCursor.vb 22 Mar 2005 06:09:03 -0000 1.16 +++ CCursor.vb 4 Apr 2005 23:49:42 -0000 1.17 @@ -270,12 +270,14 @@ Else obj.AssociationsLoaded = True End If - pbroker.InjectedObjects.Add(obj) + obj = pbroker.LocateOrCacheInjObject(obj, True, True) + 'pbroker.InjectedObjects.Add(obj) Else 'need to retrieve the proxy and then load the object clMap.populateProxy(obj, m_row, _alias) pbroker.retrieveObject(obj, False, True) - pbroker.InjectedObjects.Add(obj) + obj = pbroker.LocateOrCacheInjObject(obj, True, True) + 'pbroker.InjectedObjects.Add(obj) End If Exit Sub End If @@ -289,12 +291,14 @@ Else obj.AssociationsLoaded = True End If - pbroker.InjectedObjects.Add(obj) + obj = pbroker.LocateOrCacheInjObject(obj, True, True) + 'pbroker.InjectedObjects.Add(obj) Else 'need to retrieve the proxy and then load the object clMap.populateProxy(obj, m_row) pbroker.retrieveObject(obj, False, True) - pbroker.InjectedObjects.Add(obj) + obj = pbroker.LocateOrCacheInjObject(obj, True, True) + 'pbroker.InjectedObjects.Add(obj) End If End Sub Index: CInjectedObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- CInjectedObject.vb 4 Apr 2005 01:27:20 -0000 1.22 +++ CInjectedObject.vb 4 Apr 2005 23:49:42 -0000 1.23 @@ -418,8 +418,9 @@ obj = CallByName(o, propertyName, CallType.Get) End If If obj Is Nothing Then Return Nothing - If obj.GetType.IsSubclassOf(GetType(IPersistableObject)) Then - injobj = CType(obj, CInjectedObject) + 'If obj.GetType.IsSubclassOf(GetType(IPersistableObject)) Then + If TypeOf obj Is IPersistableObject Then + injobj = obj Else pbroker = getPersistenceBrokerInstance() injobj = pbroker.getInjectedObject(obj) Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- CPersistentObject.vb 4 Apr 2005 01:27:24 -0000 1.62 +++ CPersistentObject.vb 4 Apr 2005 23:49:43 -0000 1.63 @@ -596,9 +596,14 @@ <EditorBrowsable(EditorBrowsableState.Advanced)> _ Public Function getObjectByAttribute(ByVal pName As String) As IPersistableObject Implements IPersistableObject.getObjectByAttribute Dim dotPos As Integer + Dim obj As Object + Dim injobj As IPersistableObject + Dim pbroker As CPersistenceBroker + dotPos = pName.IndexOf(".") + Try If dotPos = -1 Then - Return CallByName(Me, pName, CallType.Get) + obj = CallByName(Me, pName, CallType.Get) Else Dim o As Object Dim objName As String @@ -606,8 +611,19 @@ objName = pName.Substring(0, dotPos) propertyName = pName.Substring(dotPos + 1) o = CallByName(Me, objName, CallType.Get) - Return CallByName(o, propertyName, CallType.Get) + obj = CallByName(o, propertyName, CallType.Get) End If + If obj Is Nothing Then Return Nothing + If TypeOf obj Is IPersistableObject Then + injobj = obj + Else + pbroker = getPersistenceBrokerInstance() + injobj = pbroker.getInjectedObject(obj) + End If + Catch ex As Exception + Throw New Exception("getObjectByAttribute failed for attribute " & pName & " in " & Me.GetType.FullName, ex) + End Try + Return injobj End Function '''----------------------------------------------------------------------------- |
From: Richard B. <rb...@us...> - 2005-04-04 01:27:39
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20383 Modified Files: CCacheEntry.vb CInjectedObject.vb CInjectedObjects.vb CPersistenceBroker.vb CPersistentObject.vb IPersistentObject.vb Log Message: Fix to stop changes to injected objects screwing up the persistence cache version. Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 --- CPersistenceBroker.vb 1 Apr 2005 00:04:08 -0000 1.103 +++ CPersistenceBroker.vb 4 Apr 2005 01:27:20 -0000 1.104 @@ -318,7 +318,13 @@ t = tmpObj.GetObjectType If t Is obj.GetObjectType Or t.IsSubclassOf(obj.GetObjectType) Then Debug.WriteLine("retrievePrivateObject: retreived from cache") + If Not obj.IsIPersistentObject Then + 'Cannot change reference for injected objects otherwise + 'the injection cache version doesn't get updated + obj.ReplaceWith(tmpObj, False) + Else obj = tmpObj + End If Try PCCacheHits.Increment() Catch @@ -410,10 +416,10 @@ cm2 = cm2.SuperClass End While obj.IsProxy = False 'Need to set non-proxy in case object is loaded via a retrieve criteria - m_cache.Add(obj) 'Add retrieved object to the cache If Not obj.IsIPersistentObject Then obj = LocateOrCacheInjObject(obj, False) End If + m_cache.Add(obj) 'Add retrieved object to the cache Try PCCacheSize.RawValue = m_cache.Count Catch @@ -446,8 +452,9 @@ If targetobj.Persistent Then If Not targetobj.IsIPersistentObject Then targetobj = LocateOrCacheInjObject(targetobj, True) + Else + tmpObj = m_cache.Item(targetobj) End If - tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj Try @@ -483,9 +490,10 @@ If udamap.ToClass.ChildrenMaps.Count > 0 Then targetobj = Me.createTargetObjectForMultipleInheritance(udamap.ToClass, obj.GetObjectType, obj.GetObjectType.Namespace, rs.ResultSet.Tables(0).Rows(i), joins, conn) If Not targetobj Is Nothing AndAlso targetobj.Persistent Then - tmpObj = m_cache.Item(targetobj) If Not targetobj.IsIPersistentObject Then targetobj = LocateOrCacheInjObject(targetobj, True) + Else + tmpObj = m_cache.Item(targetobj) End If If Not (tmpObj Is Nothing) Then targetobj = tmpObj @@ -524,8 +532,9 @@ If targetobj.Persistent Then If Not targetobj.IsIPersistentObject Then targetobj = LocateOrCacheInjObject(targetobj, True) + Else + tmpObj = m_cache.Item(targetobj) End If - tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj Try @@ -591,9 +600,10 @@ classMapCount += Me.getChildCountForMultipleInheritance(toClass) classMapCount -= 1 'This is because we added one in the beginning of the for loop If Not targetobj Is Nothing AndAlso targetobj.Persistent Then - tmpObj = m_cache.Item(targetobj) If Not targetobj.IsIPersistentObject Then targetobj = LocateOrCacheInjObject(targetobj, True) + Else + tmpObj = m_cache.Item(targetobj) End If If Not (tmpObj Is Nothing) Then targetobj = tmpObj @@ -648,9 +658,14 @@ toClass.populateObject(toClass, targetobj, rw, mapName) If targetobj.Persistent Then If Not targetobj.IsIPersistentObject Then + 'For injected objects we want to work with just one version + 'By not checking the persistent cache we can ensure this, and + 'we will also be keeping the persistent cache updated targetobj = LocateOrCacheInjObject(targetobj, True) + tmpObj = Nothing + Else + tmpObj = m_cache.Item(targetobj) End If - tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj Try @@ -712,14 +727,14 @@ End If 'now replace the cache entry with the complete object and it's populated collections obj.IsLoading = False - If resetLoadingFlag Then - m_cache.ObjectsAreLoading = False - End If m_cache.Add(obj) Try PCCacheSize.RawValue = m_cache.Count Catch End Try + If resetLoadingFlag Then + m_cache.ObjectsAreLoading = False + End If Return True End Function @@ -838,8 +853,9 @@ col.Add(anObjPers.GetSourceObject) If Not anObjPers.IsIPersistentObject Then anObjPers = LocateOrCacheInjObject(anObjPers, True) + Else + m_cache.Add(anObjPers) 'Add retrieved objects to the cache End If - m_cache.Add(anObjPers) 'Add retrieved objects to the cache Try PCCacheSize.RawValue = m_cache.Count Catch @@ -2569,7 +2585,7 @@ Dim qObj As Object Dim col As IList 'Dim stack As New Stack - Dim queue As New Queue + Dim queue As New queue Dim i, k As Integer Dim tmpObj As Object Dim injObj As IPersistableObject @@ -3016,7 +3032,7 @@ Public Sub PersistChanges(ByVal obj As Object, ByVal checkAssociationsRecursively As Boolean) Dim value As IPersistableObject - Dim queue As Queue + Dim queue As queue Dim qObject As Object Dim injObj, tmpObj As CInjectedObject Dim ckey As CCacheKey @@ -3383,4 +3399,38 @@ End If Return End Sub + + ''' ----------------------------------------------------------------------------- + ''' <summary> + ''' Forces the object to have it's attribute values refreshed. + ''' </summary> + ''' <param name="obj">The object to refresh</param> + ''' <param name="useCache">Boolean indicating wether the data should be refreshed + ''' from the cache or the database.</param> + ''' <remarks>Refresh will cause an existing object to be reset to either the values + ''' last retrieved from the database, or to the latest version of the object from + ''' the database. + ''' </remarks> + ''' <history> + ''' [rbanks] 1/04/2005 Created + ''' </history> + ''' ----------------------------------------------------------------------------- + Public Sub RefreshObject(ByRef obj As Object, ByVal useCache As Boolean) + Dim injObj As CInjectedObject + If TypeOf obj Is IPersistentObject Then + Throw New RetrieveException("The RefreshObject method cannot be used for classes that inherit from CPersistentObject. Use obj.Refresh()") + End If + injObj = LocateOrCacheInjObject(obj, False) + injObj.ResetToOriginal() + If Not useCache Then + retrieveObject(injObj, False, False) + End If + obj = injObj.GetSourceObject + End Sub + + Public ReadOnly Property Cache() As CCacheCollection + Get + Return m_cache + End Get + End Property End Class \ No newline at end of file Index: IPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/IPersistentObject.vb,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- IPersistentObject.vb 1 Apr 2005 00:04:20 -0000 1.13 +++ IPersistentObject.vb 4 Apr 2005 01:27:29 -0000 1.14 @@ -69,6 +69,7 @@ Event MarkedAsDirty As EventHandler Event LoadStarted As EventHandler Event LoadFinished As EventHandler + End Interface Public Interface IValidation Index: CInjectedObjects.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObjects.vb,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- CInjectedObjects.vb 1 Apr 2005 00:04:07 -0000 1.7 +++ CInjectedObjects.vb 4 Apr 2005 01:27:20 -0000 1.8 @@ -361,7 +361,8 @@ Public Function GetValueArray() As ArrayList Dim al As ArrayList - Dim valArray(Me.Values.Count) As Object + If Me.Values.Count = 0 Then Return New ArrayList + Dim valArray(Me.Values.Count - 1) As Object Me.Values.CopyTo(valArray, 0) al = New ArrayList(valArray) Return al @@ -369,7 +370,8 @@ Public Function GetKeyArray() As ArrayList Dim al As ArrayList - Dim valArray(Me.Keys.Count) As Object + If Me.Keys.Count = 0 Then Return New ArrayList + Dim valArray(Me.Keys.Count - 1) As Object Me.Keys.CopyTo(valArray, 0) al = New ArrayList(valArray) Return al Index: CCacheEntry.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CCacheEntry.vb,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- CCacheEntry.vb 1 Apr 2005 00:03:51 -0000 1.31 +++ CCacheEntry.vb 4 Apr 2005 01:27:19 -0000 1.32 @@ -577,7 +577,7 @@ ce.TransactionType = CCacheEntry.CacheTransaction.Saved End If Try - ce.OriginalObject = obj + ce.OriginalObject.ReplaceWith(obj, False) ce.PersistentObject.ReplaceWith(obj, False) Catch MyBase.Remove(ckey) @@ -591,7 +591,7 @@ ce = New CCacheEntry(m_expiryInterval) End If ce.PersistentObject = obj.Copy - ce.OriginalObject = obj + ce.OriginalObject = obj.Copy If obj.GetClassMap.RelationalDatabase.getConnection(Nothing).Started Then ce.TransactionType = CCacheEntry.CacheTransaction.Added End If @@ -994,7 +994,8 @@ Public Function GetValueArray() As ArrayList Dim al As ArrayList - Dim valArray(Me.Values.Count) As Object + If Me.Values.Count = 0 Then Return New ArrayList + Dim valArray(Me.Values.Count - 1) As Object Me.Values.CopyTo(valArray, 0) al = New ArrayList(valArray) Return al @@ -1002,7 +1003,8 @@ Public Function GetKeyArray() As ArrayList Dim al As ArrayList - Dim valArray(Me.Keys.Count) As Object + If Me.Keys.Count = 0 Then Return New ArrayList + Dim valArray(Me.Keys.Count - 1) As Object Me.Keys.CopyTo(valArray, 0) al = New ArrayList(valArray) Return al Index: CInjectedObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- CInjectedObject.vb 1 Apr 2005 00:04:07 -0000 1.21 +++ CInjectedObject.vb 4 Apr 2005 01:27:20 -0000 1.22 @@ -177,7 +177,13 @@ Public Property AssociationsLoaded() As Boolean Implements IPersistableObject.AssociationsLoaded Get + If Me.getClassMap.AssociationMapCount > 0 Then Return m_associationsLoaded + Else + 'If the class has no associations then associations are already "loaded" + 'However if the object is not persistent then the associations obviously can't be loaded yet + Return Me.Persistent + End If End Get Set(ByVal Value As Boolean) m_associationsLoaded = Value @@ -501,10 +507,14 @@ Public Function Copy() As IPersistableObject Implements IPersistableObject.Copy Dim injobj As CInjectedObject - injobj = CType(Me.MemberwiseClone, CInjectedObject) + injobj = Me.getClassMap.CreateObjectInstance + Me.ReplaceValues(Me.GetSourceObject, injobj.GetSourceObject, False) + 'For now we will copy the full object including event handlers + 'Me.ReplaceValues(Me.GetSourceObject, injobj.GetSourceObject, True) + 'injobj = CType(Me.MemberwiseClone, CInjectedObject) 'Because memberwise clone only reference copies collections we should also 'copy the collections as well, since failing to do so can corrupt the cache. - CPersistenceBroker.CopyCollections(Me.GetSourceObject, injobj.GetSourceObject) + 'CPersistenceBroker.CopyCollections(Me.GetSourceObject, injobj.GetSourceObject) Return injobj End Function @@ -744,5 +754,6 @@ Return True 'Return m_object.IsAlive End Function + End Class Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- CPersistentObject.vb 1 Apr 2005 00:04:18 -0000 1.61 +++ CPersistentObject.vb 4 Apr 2005 01:27:24 -0000 1.62 @@ -903,7 +903,7 @@ Public Overridable Sub Save(ByVal obj As CPersistentObject, ByVal checkAssociationsRecursivly As Boolean) Implements IPersistentObject.save Dim persistentBroker As CPersistenceBroker Dim value As IPersistableObject - Dim queue As Queue + Dim queue As queue Dim qObject As Object Dim savedKeys As New ArrayList Dim ckey As CCacheKey @@ -1959,4 +1959,5 @@ Public Function IsIPersistentObject() As Boolean Implements IPersistableObject.IsIPersistentObject Return True End Function + End Class |
From: Richard B. <rb...@us...> - 2005-04-01 01:41:26
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4635 Modified Files: userguide.sh5 Log Message: more updates Index: userguide.sh5 =================================================================== RCS file: /cvsroot/jcframework/dotnet/userguide.sh5,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 Binary files /tmp/cvsSS9hPI and /tmp/cvsZu6kw3 differ |