This sounds good. I could learn a lot here. We could take advantage of C# interactive for this. Step by simple step, with inline testing. Easy to post a command sequence or interactive session for direct comparison. No setup. Here is a session in Visual Studio 2017 (15.9.5), Windows 10 version 1809 x64. Interactive checks and responses at each step are included in comments. C# interactive uses STA threading model (checked inline below). #r "System.dll" #r "D:\manifold-9.0.168.7-x64\bin64\extnet.dll" // #r "C:\Program Files\Manifold\v9.0\Bin64\extnet.dll" // #r "C:\Program Files\Manifold\v9.0\Bin\extnet.dll" using System; // using System.Collections.Generic; // using System.Linq; // using System.Text; // using System.Threading; // using System.Threading.Tasks; using Manifold; // check COM threading model for current thread System.Threading.ApartmentState state = System.Threading.Thread.CurrentThread.GetApartmentState(); // state -> // STA Manifold.Root root = new Manifold.Root(@"D:\manifold-9.0.168.7-x64\bin64\ext.dll"); // root -> // Root { Application=Application { Name="Manifold System" } } Manifold.Application app = root.Application; // app -> // Application { Name="Manifold System" } Manifold.Database db = app.CreateDatabase(); // db -> // Database { // CanDelete=true, CanDesign=true, CanInsert=true, // CanMigrate=false, CanRefresh=false, CanRename=true, // CanRun=true, CanSave=true, CanSaveCompact=false, // Connection="", IsMigrateNeeded=false, IsReadOnly=false, // IsSaveAsNeeded=false, IsSaveCompactNeeded=false, IsSaveNeeded=true, // Technology="manifold", TechnologyResolved=null // } // line breaks added Manifold.Table table = db.Search("mfd_root"); // table -> // Table { // CanDelete=false, CanDesign=false, CanGetVersions=true, // CanInsert=false, CanRename=false, CanUpdate=false // } // line breaks added Console.WriteLine("mfd_root contains {0} fields", table.GetSchema().Fields.Count); // -> // mfd_root contains 3 fields string tech = app.GetTechnologyForFile(@"D:\Test.map", true); // tech -> // "manifold" table.Dispose(); db.Dispose(); root.Dispose(); Attachments: 20190124 C# interactive m9.txt
|