Jump to content


generate seprate projects for factories & objects


  • Please log in to reply
7 replies to this topic

#1 Guest_pstgi_*

Guest_pstgi_*
  • Guests

Posted 20 January 2006 - 11:16 AM

Is there an option to have the code generator put the factory classes in a different project/dll than the other object classes?

I wish to do this because I want strict separation between components and data access.

The component objects will be passed between layers in our application. In order to populate/fill/update/delete them it must be done on the data access layer where additional business logic could be done on the object before its returned to the calling layer.

Please advise, thankyou.

#2 Guest_pstgi_*

Guest_pstgi_*
  • Guests

Posted 24 January 2006 - 07:16 AM

any word on this?

please advise, thank you.

#3 Guest_Paul_*

Guest_Paul_*
  • Guests

Posted 30 January 2006 - 07:46 AM

I assume that you are trying to generate two separate projects/dlls one for objects/collections and the other for factory classes only. And, you might want to add the object's dll reference in factory classes (dll). If this is what you are trying to do then yes TierDeveloper TemplateIDE lets you do this. You can customize the templateset and can generate code as you need.

Here is how you can start a new project in template IDE.

0. Open your TierDeveloper project and launch Template IDE from TierDeveloper's "Tools->Template IDE..." menu.
1. Create a new project in Template IDE ("MyTemplateSet")
2. Select the pattern that you want to clone (in your case it will be "CSComponents")
3. Go to the Build Window. Click the Tragets and double click the target "Generate" from the tree list. Here it specifies what should happen when a user click "Generate" in TierDeveloper.
4. Add a new target lets say "GenerateObjects" which can generate only objects and specify its dependencies.
<target name="GenerateObjects" depends="GenerateObjs, GenXSDUtil, GenSnk" mnu-uri="Generate Objects">
</target>
5. Copy the existing target "GenerateCode" and modify its loop that generate files. And, just remove the files that you don't want when user tries to use this option. For example you don't want to generate factory classes when user selects the menu "Generate Objects" then remove the lines in bold.

<target name="GenerateFac" depends="CleanBeforeGenerate, initComponents , TypedDataSet, SpScripts , Hooks">
<CompareFileStamp src="${TierDevFile}" target="${ComponentDir}/compgenerated.dat"/>
<echostart>- - - - Generating C# Components - - - - </echostart>
<loop collection="Project.Objects" object="Project.CurrentObject" if="(Project.CurrentObject.Enabled)">
<fileset dir="${PatternSourceDir}/Components" destdir="${ComponentDir}" genUniCode="true">
<file name="Component_cs.ts" out="${Project.CurrentObject.Name}.cs" if="(Project.CurrentObject.Type != eAxCustomInfo) And (Project.CurrentObject.Type != eAxCustomInfoUnmapped)"/>
<file name="ComponentFactory_cs.ts" out="${Project.CurrentObject.Name}Factory.cs" if="(Project.CurrentObject.Type != eAxCustomInfo) And (Project.CurrentObject.Type != eAxCustomInfoUnmapped)"/>
<file name="ComponentCollection_cs.ts" out="${Project.CurrentObject.Name}Collection.cs" if="(Project.CurrentObject.Type != eAxCustomInfo) And (Project.CurrentObject.Type != eAxCustomInfoUnmapped)"/>
<file name="ComponentFactory_Assembly_cs.ts" out="${Project.CurrentObject.Name}Factory.cs" if="(Project.CurrentObject.Type == eAxCustomInfo) OR (Project.CurrentObject.Type == eAxCustomInfoUnmapped)"/>
</fileset>
</loop>

6. When done, Install your pattern through "Project->Install..." menu.
7. Re-start TierDeveloper and you'll see a new sub-menu added to "Project" menu for your new pattern. You can now generate code against your project by using this new "Pattern".

This allows you to easily copy, change, and install template patterns without affecting the already installed pattern (since your changes can
also break the generate code). You can do the same for generating Factory DLL

#4 Guest_chriss_*

Guest_chriss_*
  • Guests

Posted 17 February 2006 - 01:06 PM

Thank you Paul.

I downloaded an evaluation copy of Tier Developer today and had practically the same question !

We have created objects to store information and some behavior (without any knowledge or persistance). This object is then passed into a rules processor and squirted out where it hits the data access layer and is then persisted. Between the rules processor and data access layer is a simple mapping mechanism to decouple the objects information into the physical schema then perform the update. The idea being the object is a business representation of a function and we are not driven by physical schema. Secondly because of the coupling / decoupling process we are not restricted to any specific type of data access code.

Anyway, back to the question. We used the Object import functionality of Tier Developer to import a small dummy Object that we coded by hand and mapped that back to a table in the database. Unfortunately it would not generate a C# factory for us ... however to my suprise it did manage to generate a VB factory. We took the VB factory, included it in a test harness ... it worked perfectly !!! Our hand coded object was persisted with Tier Developer. Fantastic ! BUT, we would very much like the C# code generator to work, any idea's ?

Finally, we have elements of the schema that we allow to be customised by super users, i.e. we have an application that can be extended after installation. Are there any plans to do dynamic mapping or have some form of property bag to catch columns that were not originally generated by Tier Developer when the application was designed ? (I can elobrate upon that)

P.S. The mapping we tried sucessfully was a simple 1-1 map back to a physical table. As explained before the business representation of an object may span several physical tables, we have yet to try that but I'm not expecting that to work.

#5 Guest_Paul_*

Guest_Paul_*
  • Guests

Posted 20 February 2006 - 06:44 AM

I have checked that the C# factory classes are not generated when Object import functionality is used. I have forwarded this to Engineering. This issue is raised in version 5.2. In previous versions, it was working fine.

Please elaborate on how you want to see dynamic mapping functionality in your applications.

Basically 1-1 mapping is fully supported in TierDeveloper. We also support 1-m mapping between objects and tables. That is you can map one object to multiple tables using TierDeveloper. But this object has the limitation that it is read-only, hence you can not modify such objects. We are already working on this to remove this limitation in our future versions.

#6 Guest_Paul_*

Guest_Paul_*
  • Guests

Posted 21 February 2006 - 06:37 AM

Thanks for your suggestion and time. Actually, this is a very user dependent feature and we have not received such request from any of our customers. We'll discuss this in our next meeting with the Engineering team and decide whether we can incorporate this functionality in our product.

#7 Guest_marakal_*

Guest_marakal_*
  • Guests

Posted 16 February 2009 - 03:28 PM

Hi Paul,

I was trying to create the n-tier application with TierDeveloper 6.1 and came across this post. Is it the same way to create tiers on 6.1 version? Do you have any documenation/sample code available to create n-tiers with TierDeveloper? Thanks

#8 Guest_Kashif_*

Guest_Kashif_*
  • Guests

Posted 21 March 2009 - 12:32 AM

Yes, TierDeveloper 6.1 works in the same way as it used to be in 5.2. The documentation is installed with the TierDeveloper and you can find plenty of information about using the TierDeveloper tool and the generated code from there.

You can also read our programmers guide from the following link

http://www.alachisof...m/download.html




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users