Skip to content

Category: C#/.NET

Microsoft C#/.NET

C#/.NET 0

Combining Expression[Func[T, bool]] of different Types

The other day, I was tasked with the problem of selecting entities from IQueryable<T> based on specific filter criteria that were only known at run-time. Basically, I had objects of different type with a set of properties. Here is an example, of what we were trying to solve. We have two expressions that apply to different types and both return […]

C#/.NET 0

[NoBrainer] Simplifying and Speeding Up Testing in Sparx Enterprise Architect

Today’s post will be rather quick. I will show you how a unit/integration test class that can interact with real model data in Sparx Enterprise Architect. Beyond the well known Interop.EA assembly there is another assembly called SparxSystems.Repository that provides the intersting feature to connect to a running EA instance: Services.GetRepository(). We can use this to write unit/integration tests that […]

C#/.NET 0

Dynamically registering UserControls in Sparx Enterprise Architect AddIns for showing them with Repository.AddTab

Sparx Enterprise Architect provides a means for AddIns to display Windows via Repository.AddTab() which are based on System.Windows.Forms.UserControl. However the call AddTab expects a name for the actual tab and a PROGID. EA actually takes this PROGID and loads the UserControl via the registry (as it is actually an Active COM Control). In this post I show you how these […]

C#/.NET 0

Improvements on the SqlXmlSerialiser

This is a followup to the last article Easy Conversion from Enterprise Architect XML SQL Queries to C# Objects. Every time we execute a query that returns results from more than one table we have to use aliasing in the SQL statement to differentiate columns with the same name. See below a query that retrieves all connectors of an element […]

C#/.NET 1

Easy Conversion from Enterprise Architect XML SQL Queries to C# Objects

In this article I show you how to easily convert arbitrary SQL query results in Enterprise Architect to native C# objects. The Enterprise Architect object model provides several methods which you can use to make direct SQL queries against the underlying database. And while Repository.GetElementSet really returns a Collection of native EA.Elements (but not connectors) the more versatile Repository.SQLQuery only […]

C#/.NET 3

WPF Series -12- Global Exception Logging

During development and debugging of our WPF application some exceptions occurred which were not caught by the code. Such unhandled exceptions are not logged automatically. In order to obtain information about any unhandled exceptions in production and to simplify error analysis, we looked for a way to handle and log unhandled exceptions. After some research we ended up with the […]

C#/.NET 3

WPF Series -9- CustomListBox

When we used ListBox controls in our WPF project we faced the same problem as described in the previous post. Like DataGrid, ListBox control also has a property called SelectedItems, which isn’t a dependency property and therefore not bindable too. This post shows how ListBox control can be extended with a bindable version of the SelectedItems property. First we have […]

C#/.NET 3

WPF Series -8- CustomDataGrid

According to MVVM pattern the ViewModel interacts with the Model but doesn’t know anything about its View. As a result dependency properties of controls get bound to ViewModel properties by specifying bindings in the corresponding View (XAML). DataGrid control has a property called SelectedItems, which in multi selection mode holds the items that are selected. Unfortunately SelectedItems of DataGrid is […]