StartingHelp TopNext
SinceC#Add-IntransformsUMLmodeltoC#sourcecodeorC#sourcecodetoUMLmodel,youcanachievehighproductivityandqualityimprovementasadoptingC#codegenerationandreverseengineeringtothetooleasilyandquickly.
IndexofC#Add-InHelp
1. C#Add-InOverview
2. C#Profile
3. .NETBCLFramework
4. OptionConfigurations
5. C#ReverseEngineering
6. C#CodeGeneration
7. FAQ
C#Add-InOverview TopPreviousNext
ThischaptercontainsageneraloverviewofC#Add-In:functionsandconfigurationprocedures.
C#Add-InFunctions
C#Add-InConfigurations
C#Add-InFunctions TopPreviousNext
C#Add-Inprovidesthefollowingfunctions.
C#Profile
C#profileisprovidedtoallowvisualmodelingofC#conceptssuchaspackage,class,interface,using,modifierandsooninStarUML(tm).IncludetheC#profilewhenyoustartyourStarUML(tm)project,inordertoapplythefeaturesoftheC#languageinyoursoftwaremodeling.
.NETBCLModelFramework
C#Add-InprovidestheECMA-334StandardLibraryintheModelFrameworkformat.
C#ReverseEngineering
C#Add-InprovidesthereverseengineeringfunctionthatgeneratesStarUML(tm)modelsbyanalyzingC#codes.
C#CodeGeneration
C#Add-InprovidestheforwardengineeringfunctionthatgeneratesC#codesbyanalyzingStarUML(tm)models.
Note
ThescopeofapplicationforC#Add-InisC#codesbasedonECMA-334(C#LanguageSpecificationv1.2).
C#Add-InConfigurations TopPreviousNext
OnceC#Add-Inisinstalled,itisenabledforuseinStarUML(tm)bydefault.InstalledAdd-InscanbeenabledordisabledthroughAdd-InManagerinStarUML(tm).IfanAdd-Inisdisabled,nomainmenuandpopupmenuitemsrelatedtoitaredisplayed,andnoStarUML(tm)eventsarerelayedtoit.
ProcedureforEnablingC#Add-In:
1. Selectthe[Tools]->[Add-InManager...]menuinStarUML(tm).
2.AttheAdd-InManagerdialogbox,checkthe"C#Add-In"checkboxin
theAdd-Inlist.
3. Clickthe[OK]buttontoclosethedialogbox.
ProcedureforDisablingC#Add-In:
1. Selectthe[Tools]->[Add-InManager...]menuinStarUML(tm).
2.AttheAdd-InManagerdialogbox,uncheckthe"C#Add-In"checkboxin
theAdd-Inlist.
3. Clickthe[OK]buttontoclosethedialogbox.
C#Profile TopPreviousNext
ThischapterdescribesC#profile:configurationproceduresanddefinitions.
IncludingC#Profile
ExcludingC#Profile
C#ProfileDefinitionList
IncludingC#Profile TopPreviousNext
C#profilemustbeincludedintheprojectinordertoutilizetheStereotypes,TagDefinitions,andDataTypesdefinedinC#profile.
ProcedureforIncludingC#Profile:
1. Selectthe[Model]->[Profiles...]menu.
2.AttheProfileManagerwindow,select"C#Profile"fromthe"Available
profiles"listontheleft.
3.Clickthe[Include]buttonorhitAlt-Itomove"C#Profile"tothe
"Includedprofiles"list.
4. Clickthe[Close]buttontoclosetheProfileManagerwindow.
5. C#profileisincludedinthecurrentproject.
Note
OpeningaprojectwithC#profileonanotherStarUML(tm)systemthatdoesnothaveC#profileinstalledmayresultinlossofextension
informationofmodelelements(Stereotype,TaggedValue,etc).
ExcludingC#Profile TopPreviousNext
C#profilecanbeexcludedfromthecurrentproject.OnceC#profileisexcluded,Stereotypes,TagDefinitionsandDataTypesdefinedintheprofilecannotbeusedintheproject.
ProcedureforExcludingC#Profile:
1. Selectthe[Model]->[Profile...]menu.
2.AttheProfileManagerwindow,select"C#Profile"fromthe"Included
profiles"listontheright.
3.Clickthe[Exclude]buttonorhitAlt-Etoremove"C#Profile"fromthe
"Includedprofiles"list.
4. Clickthe[Close]buttontoclosetheProfileManagerwindow.
5. C#profileisexcludedfromthecurrentproject.
Note
Re-includingC#profileafterexcludingitdoesnotrestorethepreviously
editedtaggedvaluesofthemodelelements.
C#ProfileDefinitionList TopPreviousNext
Stereotype
C#profilecontainsdefinitionsforthefollowingstereotypes.
SterotypeTargetElement Description
<<CSharpSourceFile>>Component SourcefilewithC#code<<DotNetAssembly>> Component FilewithcompiledC#sourcecode<<CSharpDelegate>> Class C#Delegateindicator<<CSharpStruct>> Class C#Structindicator<<CSharpEvent>> Operation C#Eventindicator<<CSharpProperty>> Operation C#Propertyindicator<<CSharpOperator>> Operation C#Operatorindicator<<CSharpIndexer>> Operation C#Indexerindicator
TagDefinition
C#profilecontainsdefinitionsforthefollowingtagdefinitions.
TagDefinition Type TargetElement Description
CSharpOverride BooleanOperation
Aninstancemethoddeclaredbyusinganoverridemodifieriscalled"redefinitionmethod".Aredefinitionmethodredefinesaninheritedvirtualmethodthathasthesamesignature.
CSharpVirtual BooleanOperation
Ifadeclarationcontainsavirtuallimiter,themethodiscalled"virtualmethod".Ifthereisnovirtualmodifier,
themethodiscallednon-virtualmethod.
CSharpExplicit BooleanOperation
Theexplicitkeywordisusedfordeclaringexplicituserdefinitionformatconversionoperators.
CSharpExtern BooleanOperation
Usingtheexternlimiterinthemethoddeclarationindicatesthatthemethodismanipulatedexternally.
CSharpSetter BooleanOperation Propertyaccessorsincludeexecutionlinesrelatedtoimportingproperties(readingorcalculating)andconfiguringproperties(writing).Anaccessdeclarationmayincludethegetaccessor,thesetaccessor,orboth.
CSharpGetter BooleanOperation
CSharpAdd BooleanOperation Thesearedeclarationsofaccessorsthatareusedforaddingorremovingeventprocessorsintheclientcode.Accessorfunctionsareaddandremove.
CSharpRemove BooleanOperation
CSharpConstructorInitializer String Operation
Thisdefinesotherinstancegeneratorsthatwillbecalledbeforeexecutingthelinesintheinstancegenerator.
CSharpImplicit BooleanOperation
Theimplicitkeywordisusedfordeclaringimplicituserdefinitionformatconversionoperators..
CSharpUnsafe BooleanClass,Operation,Attribute,AssociationEnd
Theunsafekeywordindicatesunsafecontexts.
CSharpNew BooleanClass,Operation
Thenewmodifierisusedforexplicitlyhidingthemembersinheritedfromthebasicclasses.
CSharpStatic BooleanClass,Operation,Attribute
Thestaticmodifierisusedfordeclaringnotspecificobjectsbutstaticmembersthatbelongtospecificformats.
CSharpConst BooleanAttribute
Theconstkeywordisusedforeditingdeclarationsofdatamembersorlocalvariables.
CSharpVolatile BooleanAttribute,AssociationEnd
Thevolatilekeywordindicatesthatthedatamembercanbeeditedintheprogrambythreadsrunbytheoperating
system,hardware,orbothatthesametime.
CSharpInternal BooleanClass,Operation,Enumeration
Theinternalkeywordisanaccessmodifierforformatsandformatmembers.Internalmemberscanbeaccessedwithinthesameassemblyfileonly.
CSharpBasetype String Enumeration
Eachenumerationformatincludesanintegertypeformatcalledinternalformatoftheenumerationformat.Thisinternalformatmustbeabletoexpressallenumerationvaluesdefinedintheenumeration.
CShapEnumLiteralValue String EnumerationLiteral
Eachenumerationmembercontainsaconstantvalue.Theformatofthisvalueistheinternalformatoftheenumeration.
CSharpDimension IntegerParameter,Attribute,AssociationEnd
Thisisthearraydimensionoftheobjectdeclared.
CSharpParameter Boolean Parameter
Parameterarraysareparametersdeclaredbyusingtheparamsmodifier.Iftheparameterarrayisincludedintheformatparameterlist,itmustbelocatedattheendoftheparameterlistandithastobein1-dimensionarrayformat.
DataTypes
C#profilecontainsdefinitionsforthefollowingbasicC#datatypes.bool
decimal
sbyte
byte
short
ushort
int
uint
long
ulong
char
float
double
object
string
void
.NETBCLFramework TopPreviousNext
The.NETBCL(BaseClassLibraries)FrameworkistheC#developmentplatformmodelincludedinC#2StandardEdition.InStarUML(tm),aModelFrameworkreferstoasoftwaremodelthatexpressesaClassLibraryorapplicationframeworkssuchasMFC,VCL,andJFC.Usingaframeworkwiththeprojectgreatlyincreasestheconvenienceoftheuserformodelingsoftwarethatdependsonacertainclasslibraryorapplicationframework.
Usingthe.NETBCLFramework
Usingthe.NETBCLFramework TopPreviousNext
ProcedureforImportingthe.NETBCLFramework:
1. Selectthe[File]->[Import]->[Framework...]menu.
2. Atthe[ImportFramework]dialog,selectthe.NETBCLFrameworkfromthelistandclickthe[OK]button.
3.
TheSelectElementdialogboxwillappeartodetermineinwhichelementthe.NETBCLframeworkwillbelocated.Selectanelement(package,model,subsystemorproject)tocontaintheframeworkandthenclickthe[OK]button.
4. Theframeworkisincludedintheselectedelement.
Note
Importingaframeworkdoesnotstoretheframeworkelementsintheproject.Sinceframeworkunitsarereferencedbytheproject,theframeworkunitfilesmustbepresentwhenopeningtheproject.Todeletetheimportedframeworks,removetherespectiveframeworkunits.
OptionConfigurations TopPreviousNext
ThischapterdiscussesproceduresforconfiguringtheC#Add-Inenvironmentanddescribestheoptionitemsindetail.
CodeGenerationOptionConfiguration
ReverseEngineeringOptionConfiguration
CodeGenerationOptionConfiguration TopPreviousNext
CodeGenerationOption([Tools]->[Options...])isthegroupofoptionitemsforcodegenerationbyC#Add-In.Thiscategoryincludesthe[General],[CodeGeneration],[CodeStyle],and[FileHeader]sub-categories.
General
OptionItem Default DescriptionGeneratecodesevenwhenthereisnoprofile
FalseSpecifieswhethertogeneratecodesevenwhenC#profileisnotloadedintheproject(notrecommended).
CodeGeneration
OptionItem Default DescriptionGenerate1fileeachforClass,Struct,Interface,andEnum
True Specifieswhethertogenerate1fileeachfor1member(Class,Struct,Interface,andEnum).
Generateunnamed FalseGeneratesunnamedAssociationEndasareferencetypefieldforC#member.Inthiscase,
AssociationEnd thefieldidentifierisindicatedas"UnspecifiedType"withanumberattheend.
GenerateC#Doc False SpecifieswhethertogeneratemodelingelementdocumentationasC#Doc.
GenerateemptyC#Doc False
Ifchecked,C#Docisgeneratedevenwhenthemodelingelementdocumentationdoesnothaveanyvalues(empty).
CodeStyle
OptionItem Default DescriptionInserttabsasspaces False Usesspaceinsteadoftabforindentation.
Tabwidth 4 Specifiesthenumberofspacestobeusedwheninsertingtabsasspaces.
Placetheopeningcurlybraceinthenewline
False Placestheopeningcurlybrace"{"inthenewline.
FileHeader
OptionItem Default Description
FileHeaderComments
See
description
Addsthecommentsinthebeginningofthe
sourcefile.
(Default)
//
//
//GeneratedbyStarUML(tm)C#Add-In
//
//@@Project:@p
//@@FileName:@f
//@@Date:@d
//@@Author:@a
//
//
ReverseEngineeringOptionConfigurations
TopPreviousNext
ReverseEngineeringOptionConfiguration([Tools]->[Options...])isthegroupofreverseengineeringoptionitemsforC#Add-In.Thiscategoryincludesthe[ModelGeneration],[Diagram]and[View]sub-categories.
ModelGeneration
OptionItem Default DescriptionGeneratepublicmember True Specifieswhethertogenerateclassandinterface
memberswithpublicvisibility.Generateinternalmember True Specifieswhethertogenerateclassandinterface
memberswithinternalvisibility.Generateprotectedmember True Specifieswhethertogenerateclassandinterface
memberswithprotectedvisibility.Generateprivatemember True Specifieswhethertogenerateclassandinterface
memberswithprivatevisibility.Omitinitialvalueforfields False Doesnotincludethefieldinitialvalueinthe
Attributemodelinformation.
GenerateC#Docasdocumentation False
itasdocumentationinformation.C#Docofeachmethodisanalyzedfortaginformationandenteredasdocumentationinformationforeachparameteroftheoperationmodel.
GeneratefieldsasAssociation False
Analyzesthefieldinformationinthesourcecodetoestablishassociationrelationshipswiththerespectivefieldtypemodels.Ifunchecked,fieldinformationisgeneratedasattributefortherespectiveclassmodel.
Diagram
OptionItem Default Description
GenerateOverviewdiagram True
SpecifieswhethertogeneratetheOverviewdiagramforthegeneratedmodel.Ifunchecked,thefollowingdiagramandviewoptionsareignored.
Fitthediagramareatothegeneratedviewarea
False EnlargestheOverviewdiagramtofitthegeneratedviewarea.
Diagramname Overviewof%s
SpecifiestheOverviewdiagramname.Thepackagenamecanbeincludedinthediagramnamebyusing%s(e.g.Overviewof%s).
View
OptionItem Default DescriptionSuppresstheAttributecompartmentofClass
FalseSuppressestheAttributecompartmentoftheClassViewwhengeneratingtheOverviewdiagram.
SuppresstheOperationareaofClass
FalseSuppressestheOperationcompartmentoftheClassViewwhengeneratingtheOverviewdiagram.
Hideoperationsignature False Hidestheoperationsignaturewhengenerating
theOverviewdiagram.
GenerateGeneralizationandRealizationviewsonlyforrelations
False
GeneratesgeneralizationandrealizationviewsonlyforrelationswhengeneratingtheOverviewdiagram.Whenusedappropriatelywithotherviewoptions,thisoptionisveryusefulfordrawingtheinheritancerelationsofoverallclassesandinterfaceswithinthepackage.
C#ReverseEngineering TopPreviousNext
ThischapterdiscussestheproceduresforusingC#reverseengineeringandtheconceptsofreverseengineering.
C#ReverseEngineering
ReverseEngineeringOptionConfiguration
C#ReverseEngineering TopPreviousNext
ProcedureforReverseEngineering:
1.InStarUML(tm),selectthe[Tools]->[C#]->[ReverseEngineering...]
menu.
2.Atthe[SelectSourceCode]pageinthe[C#ReverseEngineering]dialogbox,selectasourceandclick[Add].Click[Next]onceyouhavecompletedaddingthetargetsourcesforreverseengineering.
3. Atthe[SelectthePackagetocontainresult]page,selectapackagetocontaintheoutputresultsfromthepackagetreeandclick[Next].
4. Atthe[OptionSetup]page,selectthereverseengineeringoptionsandclick[Run].Reverseengineeringwillstartnow.
5. The[ReverseEngineering]pagewillshowthereverseengineeringprogressstatusandreturnreverseengineeringfailureorsuccessresults.
Note
IfC#reverseengineeringisexecutedwithoutincludingC#profile,thefollowingdialogboxwillappearaskingwhetheryouwanttoincludeC#profile.Select"Yes(Y)"tocontinuethereverseengineeringprocess.
ReverseEngineeringOptionConfiguration
TopPreviousNext
ReverseEngineeringOptionSetupScreen
ThisisthescreenforconfiguringtheoptionsrequiredforC#reverseengineering.
ModelGeneration
ModelGenerationincludesvariousoptionsformodelgeneration.Item DescriptionGenerateC#doctomodeldocumentation
SpecifieswhethertogenerateC#DocumentasStarUML(tm)modeldocumentation.
Omitfieldinitialvalues SpecifieswhethertoomittheinitialvaluesforC#fields.
public Specifieswhethertogenerateelementswithpublicaccess
modifiers.
package Specifieswhethertogenerateelementswithpackageaccessmodifiers.
protected Specifieswhethertogenerateelementswithprotectedaccessmodifiers.
private Specifieswhethertogenerateelementswithprivateaccessmodifiers.
ReferenceFieldCreation
ReferenceFieldCreationspecifiesgenerationmethodsforreferencefieldswhengeneratingmodels.Item DescriptionGeneratethefieldtotheAttributes
SpecifieswhethertogenerateC#fieldsasStarUML(tm)modelattributes.
GeneratethefieldtotheAssociations
SpecifieswhethertogenerateC#fieldsasStarUML(tm)modelassociations.
Diagram
Diagramspecifiesdiagramgenerationandthedefaultgenerationnames.Item DescriptionCreateOverviewdiagram
SpecifieswhethertogenerateOverviewdiagramwhengeneratingmodel.
ThenameofDiagram
SpecifiesnamesforOverviewdiagramgeneration.Thestring%sisautomaticallyreplacedbythepackagename.
View
Viewspecifiesview-relatedoptionsaftermodelgeneration.Item DescriptionSuppresstheAttributecompartment
Suppressestheattributeareaofclassmodels.
Suppressthe
Operationcompartment
Suppressestheoperationareaoftheclassmodels.
Hideoperationsignature
Specifieswhethertodisplayallsignaturesforoperationelements.
Generategeneralizationandrealizationviewsonly
Specifieswhethertogenerategeneralizationandrealizationviewsonlyforthemodelsgenerated.
C#CodeGeneration TopPreviousNext
ThischapterdiscussestheproceduresforusingC#codegenerationandtheconceptsofforwardengineering.
C#CodeGeneration
CodeGenerationOptionConfiguration
C#CodeGeneration TopPreviousNext
ProcedureforCodeGeneration:
1. InStarUML(tm),selectthe[Tools]->[C#]->[Generatecode...]menu.
2. Atthe[SelectPackageStartingLocation]pageinthe[Generatecode...]dialogbox,selectapackageandclick[Next].
3. Atthe[Selectthecodegenerationelement]page,selecttheelementsandclick[Next].
4. Atthe[SelectOutputDirectory]page,selectadirectorytosavetheoutputsourcesandclick[Next].
5. Atthe[OptionSetup]page,selectoptionsandclick[Next].Reverseengineeringwillstartnow.
6. The[CodeGeneration]pagewillshowthecodegenerationprogressstatusandreturncodegenerationfailureorsuccessresults.
Note
ThefollowingerrorwilloccurifC#codegenerationisexecutedwithoutincludingC#profile.PleaseensurethatC#profileisincludedintheprojectbeforeexecutingcodegeneration.
CodeGenerationOptionConfiguration TopPreviousNext
CodeGenerationOptionSetupScreen
Thisisthescreenforconfiguringtheoptionsrequiredforcodegeneration.
GenerationOptions
Generationoptionsaremodel-relatedoptionsforcodegeneration.Item DescriptionGenerateonefileforeachelement Specifieswhethertogenerateonefileforeachelement.
GenerateunnamedAssociationEnd
SpecifieswhethertogeneratecodeforunnamedAssociationEnds.
GeneratedocumentationasC#Doc
SpecifieswhethertogenerateStarUML(tm)modeldocumentationasC#Doc.
GenerateemptyC#Doc
SpecifieswhethertogenerateemptyStarUML(tm)documentation.
CodeStyleOptions
CodeStyleoptionsaretext-relatedoptionsforcodegeneration.Item DescriptionPlacetheopeningcurlybraceinthenewline
Placestheopeningcurlybrace"{"inthenewline.
Inserttabasspace Usesspaceinsteadoftabforindentation.
Tabwidth Specifiesthenumberofspacestobeusedwheninsertingtabsasspaces.
FileHeaderComments
FileHeaderCommentsdefinesthecommentsforeachfileheadItem Description
Fileheadercomments
Containsthecommentstobeinsertedinthebeginningofthesourcefile.Asdescribedinthe"headercommentsdescription"section,the'@'symbolandalphanumericcharacterscanbeusedtoinsertspecificvalueshere.
FAQ TopPrevious
ThefollowingarefrequentlyaskedquestionsandanswersforusingC#Add-In.
1. WhataretheC#LanguageversionssupportedbyC#Add-In?
2. Igeta"C#Profileisnotloaded"warningwindowwhengeneratingcode.Whatdoesthismean?
1.WhataretheC#LanguageversionssupportedbyC#Add-In?C#Add-InsupportsC#LanguageSpecificationversion1.2,whichisthemostwidelyusedversion.C#Add-InalsosupportstheECMA-334standard.
2. Igeta"C#Profileisnotloaded"warningwindowwhengeneratingcode.Whatdoesthismean?C#ProfilemustbeincludedinordertousetheC#codegenerationfunction.IncludingC#Profile