Tallan's Technology Blog

Tallan's Top Technologists Share Their Thoughts on Today's Technology Challenges

Category Archive for "Custom Software Development"

Using T4 Templates to Generate C# Enums from SQL Server Database Tables

Lenni Lobel

When building applications with C# and SQL Server, it is often necessary to define codes in the database that correspond with enums in the application. However, it can be burdensome to maintain the enums manually, as codes are added, modified, and deleted in the database.
In this blog post, I’ll share a T4 template that I wrote which does this automatically. I looked online first, and did find a few different solutions for this, but none that worked for me as-is. So, I built this generic T4 template to do the job, and you can use it too.
Let’s say you’ve got a Color table and ErrorType table in the database, populated as follows:

Now you’d like enums in your C# application that correspond to these rows. The T4 template will generate them as follows:

Before showing the code that generates this, let’s point…

Making the Case for Entity Framework in the Enterprise

Recently, I was met with some friction by the IT department at a client where, they asserted, that a decision had been made years ago to ban Entity Framework. Like many enterprise environments, this client was understandably concerned with the potential pitfalls of embracing Entity Framework. That meant that my job was to convince them otherwise – not to discount their apprehension, but quite the contrary – to demonstrate how EF can be leveraged for its advantages, and avoided for its shortcomings.
Entity Framework (EF) is a broad framework with many optional parts. There are several aspects of EF that provide great benefit, while others are a source of great consternation – particularly from the perspective of the database purist. As the cliché goes, “with great power comes great responsibility,” and so this blog post explores different aspects of EF, and…

Solving Plugin Types Import Failure on Dynamics 2016 up 1 On Premise

Chris Magrane

This is the error I received when trying to import a managed solution into an organization where an early version of it already existed.
From the import log :
Plugin Types import: FAILURE. Error: Plugin: [PluginAssemblyName], Version=, Culture=neutral, PublicKeyToken=c66c1d5121b276ee of PluginTypeName: Microsoft.Crm.Entities.PluginType and PluginTypeNode: System.Xml.XmlElement caused an exception.
This one was new to me and caused me to have to do some digging, first I had to be reminded how to start digging, and the first step should be to enable tracing, which you can find here : https://support.microsoft.com/en-us/help/907490/how-to-enable-tracing-in-microsoft-dynamics-crm.  Then after that do your import and go to the TraceDirectory to find the internal exception causing this import exception.
That lead me to this exception from the trace logs :
>Crm Exception: Message: Plugin Types import: FAILURE. Error: Plugin: [PluginAssemblyName], Version=, Culture=neutral, PublicKeyToken= of PluginTypeName: Microsoft.Crm.Entities.PluginType and PluginTypeNode: System.Xml.XmlElement caused an exception., ErrorCode: -2147188718, InnerException: Microsoft.Crm.CrmException: A managed…

Design-Time Properties for Custom SSIS Objects – Part 1 – Intro & Tasks

Matthew Gajdosik

Managing the editable properties of your custom objects in SQL Server Integration Services (SSIS) is a great way to improve their usability, but how can you? By properties, I mean the common fields exposed on the Properties tool window in Visual Studio, any time you’re working with a visual designer, and which you’ve probably used any time you wanted to make a precise change, or a quick change.
In SSIS, you can create your own class to handle all of the following types:

Data Flow / Pipeline Components
Control Flow Tasks
Connection Managers
Log Providers
For Each Enumerators (for the for each loop task)

For the most part, these custom classes can be directly modified when editing SSIS packages in Visual Studio, and so anything properties you expose on the class can be edited right from Visual Studio without opening up any new UIs. For simple objects especially, these can…


Synthetic Type Inference in JavaScript

Aesa Kamar

TypeScript is Microsoft’s Open Source solution to the dynamic nature of JavaScript. It served the job of making code safer and more maintainable, but a lot of people find it bulky and cumbersome to use. By enabling a new compiler flag in VS Code, you can get IntelliSense, static type information, and code completion for free. And the best part is, you can keep writing vanilla JavaScript!

To start, you can add a file called “jsconfig.json” to the root of your project. You’ll need to add some compiler options, and set “allowSyntheticDefaultImports” to true.

This allows the VSCode precompiler to get type information about your variables and functions, presenting you with handy information when you hover over a symbol.

You can get type information about primitives, or even more complex objects.

And your es6 class declarations too!

The synthetic type inference is smart and can…

Fixing SQL Server 2012 Support for Custom SSIS Objects in Visual Studio 2015+

Matthew Gajdosik

You’re using the new One Designer cross-versioning in SQL Server Integration Services, and everything breaks when you try to downgrade to SQL Server 2012. The little icon that indicates that everything has gone wrong shows up,
or when you try to interact with any custom components or tasks you get the following error, or something similar:

Now, there are three things worth checking:

Are your UpgradeMapping files set up correctly? They should point to a valid strong-named assembly, and use the same alias, for both versions of SQL Server that you’re attempting to deploy to. If not, fix this issue first and try again.
After migrating your custom objects, navigate to the UserComponentTypeName property (for PipelineComponents) or to the CreationName field of the corresponding DTS:Executable in the package XML.

These should contain either the alias (typically the qualified name of the class, i.e. Sample.SSIS.CustomTask),
or the strong-name associated with…

Analysis Services Tabular: Many-To-Many Relationships, Bridge Tables, and Blank Members

Matthew Gajdosik

With bidirectional filtering in SQL Server Analysis Services (SSAS) Tabular 2016, it’s easier than ever to build many-to-many relationships into your model. But what are some ways to avoid trouble when building them? This post covers two topics: (1) a scenario that can cause Tabular to match completely unrelated groups across a many-to-many relationship, and (2) some strategies for automating your bridge tables (including where they might need some brains!). If you’re already comfortable with this topic, and just want to see some DAX, feel free to skip right to the calculated bridge tables.
Otherwise, let’s say you’ve built up your many-to-many relationship based on a bridge or relationship table someone generated in the database, and have measures based on one or both of the tables connected by the bridge. When looking at the results, you see that a number of the results…

Creating an Effortless Custom SSIS Object Installer Using WiX

Matthew Gajdosik

When I first wrote custom objects for SQL Server Integration Services (SSIS), distributing my DLL for use and for installation on servers seemed troublesome. Of course, I had to set up an installer. But after the deprecation of the normal setup/installer project included with Visual Studio, which tool could be used that would be easily shared and maintained, and still meet all of the needs for distributing the custom SSIS objects?
Ultimately, I chose the WiX Toolset, as it is already integrated with the Visual Studio gallery and makes a simple job of product versioning, Global Assembly Cache (GAC) / assembly installation, and install path selection. In this tutorial, I will walk through the construction of a skeleton custom SSIS Task and a corresponding WiX installer, that can locate the correct version of SQL Server, install to both the DTS folders and…

Entity Framework Core Thumbnail

EF6 vs. EFCore: Source Code Beauty

Aesa Kamar

I was doing some comparative analysis on some of the libraries in Apache Spark when I stumbled upon this project, CodeFlower by fzianinotto. It represents source code visually by graphing each source file, linking them by their directory and dependency structure, sizing them by count of lines of code, and coloring them accordingly. The images are sized proportionately.
So I took a look at the two versions of Entity Framework that the DotNet team at Microsoft has been supporting and visualized them.
They probably make nice wall posters.

Entity Framework Core
Entity Framework 6
To learn more on how Tallan can transform your data into actionable insights and help you capitalize on business opportunities, CLICK HERE.

Applying new NIST standard to Asp.Net Pt. 1 (PBKDF2, SHA256, Password content)

Jeremy Mill

Most developers know that you should never store passwords in plain text, and know that they should be hashed. Only slightly fewer know that they should be stored utilizing a “salt” to append to the password to prevent time trade-off attacks (1). Fewer know what hash function they should use, and it seems lately, the majority don’t know that they shouldn’t just be salting and hashing at all, and instead should be using a key derivation function such as PBKDF2, or scrypt. We will be exploring utilizing PBKDF2, but scrypt is a perfectly viable option. The current draft of the new NIST guidelines says (2):
Verifiers SHALL store memorized secrets in a form that is resistant to offline attacks. Secrets SHALL be hashed with a salt value using an approved hash function such as PBKDF2 as described in [SP800-132]. The salt…