Implementation

Helmut.Ortmann edited this page Sep 22, 2017 · 24 revisions

Implementation

Here you find information related to understanding and enhance the implementation.

IDE: Vissual Studio 2017 Community

Start VS2017 as Administrator to ensure installation of COM *.dlls!

Structure

Projects

Projects Description Addin Tab
AddInSimple Simple Add-In with Shape Script feature, LINQ to SQL, Add-In Search no
AddInSimpleSetup Simple Add-In Setup for Deployment (WIX toolset) no
hoToolsGui MainWindow 'hoTools'
hoToolsRoot Basic class to register hoTools Addin by EA no
AddinFramework Geert Bellekens Framework, modified no
DuoVia.FuzzyStrings Fuzzy Search algorithm from Duovia Inc. no
EaServices Reusable services no
hoFindAndReplace Find and Replace 'Find'
hoLinqToSql Drivers and utilities to use and write LINQ to SQL queries no
HybridScriptDll Example how to develop an C# .dll to call from EA Script (VB,JavaScript, JScript) no
HybridScriptExe Example how to develop an C# .exe to call from EA Script (VB,JavaScript, JScript) no
hoSqlGui SQL + Script 'SQL' and 'Script'
Setup WIX project to create a Windows installer *.msi no
Util Utilities no

Needed

I use NuGet packages. To build the *.msi with WIX Setup Project I use paths to the dlls. I haven't found a better way.

Name Package Description *.dll
ClosedXML ClosedXML.0.81 XML access for Excel ClosedXML.dll
DocumentFormat.OpenXml DocumentFormat.OpenXml.2.5 XML library DocumentFormat.OpenXml.dll
HtmlAgilityPack HtmlAgilityPack Easy Access HTML, LINQ support HtmlAgilityPack.dll
Interop.EA.dll no EA DLL to connect .NET to COM (SPARX). Use from your EA Installation (not delivered!) Interop.EA.dll
Json.NET Newtonsoft.Json.10 JSON framework for .NET Newtonsoft.Json.dll
KBCsv KBCsv.5.0.0 CSV import KBCsv.dll
KBCsv.Extension.Data KBCsv.Extension.Data.5.0.0 CSV import Extensions KBCsv.Extensions.Data.dll
linq2db, linq2dbAccess,linq2dbMySql, linq2dbPostgreSQL, linq2dbSqlServer, linq2dbSybase, linq2db.t4models Core+DataProviders for LINQ to SQL linq2db.dll, MySql.Data.dll, Microsoft.SqlServer.Types.dll, Oracle.ManagedDataAccess.dll, Npgsql.dll, Sybase.AdoNet2.AseClient.dll, sybdrvado20.dll
WIX TOOLSET no To create Windows installer package no

Folders involved

It may slightly differ dependent on the Windows release.

Application / Software

The deployed application with defauklt settings.

users<userName>AppData\Local\Apps\hoTools\

Name Description
hoToolsGui.dll.config Default configuration
EaStandardSearches.json Documentation EA Standard Searches for Searching
Settings.json Diagram and Diagram Object Styles
SQL.zip Some of my searches you may use to see how it works

Configuration

Delete to get default configuration.

users<userName>AppData\Roaming\Apps\ho\hoTools\user.config

Name Description
user.config User configuration and settings
userSearches.json Documentation of user Searches (see EaStandardSearches.json)
Settings.json Diagram and Diagram Object Styles

SQL error

The files are also accessible via hoTools, Help menu.

  • %APPDATA%\Sparx Systems\EA\dberror.txt (Last SQL error, deleted before SQL is processed)
  • %APPDATA%\Sparx Systems\EA\hoTools_LastSql.txt (The SQL string send to database)
  • %APPDATA%\Sparx Systems\EA\hoTools_SqlTemplatesAndMacros.txt (hoTools Macros and templates, after first SQL execution)

Deployment

I use WIX to generate the *.msi file. The structure is:

  • Project Properties for general things like name of *.msi file
  • Product.wxs (general information of the product)
  • Files.wxs (Which files to include)
  • Directories (Usually no need to change)

COM Objects

hoTools does communication with EA via Windows COM.

Check your registration with EA Installation Inspector V4

What you need to know:

  • Without proper COM objects, EA won't load you Add-In (the error message is almost meaningless for most people)
  • COM Objects
    • hoToolsRoot (Add-In root)
    • hoToolsGui (hoToolsGui)
    • hoSqlGui (SQL GUI)
    • hoFindAndReplaceGui (Find and replace GUI)
  • Register COM objects
    • You have to register COM objects
    • You have to say Visual Studio what a COM object is
    • You have to include COM objects with their registration in your Files.wxs
      • run the Collect batch to extract registration information from *.dll
      • insert in your files.wxs component
    • If you change the Assembly version of a COM object, you have to adapt the registration information in Files.wxs component. You can do it by WIX or simply by updating the version.
  • Check with EA Installation Inspector V4
Registration in Code

The easiest way is to control registration via [Attributes] in code.

[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("82A06E9C-7568-4E4B-8D2C-A53B8D9A7272")]
[ProgId("hoTools.hoToolsGui")]
[ComDefaultInterface(typeof(IHoToolsGui))]

References

Books

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.