You can add reference to VisualComponents.eCatalogue.DataModel.dll and then do something like this. I didn’t test it so handling details such as file paths etc. might be wrong.
using Caliburn.Micro; using System; using System.Collections.Generic; using System.Linq; using VisualComponents.Create3D; using VisualComponents.eCatalogue.DataModel.Data; using VisualComponents.eCatalogue.DataModel.Data.Entities; namespace ECatAdder { class ECatAdderTest { private List<Item> eCatComponentCache; public ISimComponent AddComponent(IApplication app, string componentVCID) { if (eCatComponentCache == null) { eCatComponentCache = EnumerateECatComponents(); } var eCatItem = eCatComponentCache.FirstOrDefault(i => i.VCID == componentVCID && i.IsLocalItem); if (eCatItem == null) throw new ArgumentException("Unknown VCID"); ISimComponent[] loadedComponents = app.LoadLayout(new Uri(eCatItem.FileUri)); return loadedComponents.FirstOrDefault(); } /// <summary> /// Queries the local eCatalog SQL database for all components. /// </summary> /// <returns></returns> private List<Item> EnumerateECatComponents() { var eCatContext = IoC.Get<IECatDataContext>(); var eCatItems = eCatContext.EnabledItems; // Need to get all to a list first so Entity Framework doesn't try to convert the Where clause to SQL. return eCatItems.ToList() .Where(i => !i.IsDeprecated && i.ModelType == "Component") .ToList(); } } }