Saturday, February 17, 2018

MS SQL - Dynamic Table Columns Generated from SQL's XML Field

I was working on a project where I needed to archive various XML documents for various applications. The main concept was to store all XMLs in one table as a varbinary and their meta data would be stored in a smaller XML field called 'XMLProps'.

Key Requirements:
- Each application could have different meta data fields, but an application's fields must be the same for all of its data
- Application's meta data needs to be searchable, and the columns returned will need to be the meta data's XML fields
- All applications will store their XML data and meta data in one table

Key Issue Being Solved:
- This solution returns a table using the XML's SQL fields as the columns; thus producing dynamic columns per application.

Here's the SQL Fiddle (For those who want to play): http://sqlfiddle.com/#!18/35637/1/0

Here's the code with comments:

Read More

Thursday, February 15, 2018

C# - Load Assembly from Remote Server

Working on a C# reflection web project, I needed to load various dlls from a remote server's GAC_MSIL location. Armed with only a Turky Hill green tea and the assembly's full name, I set out on the web to seek some guidance.



Assuming:
- The dll is stored on the remote server's GAC_MSIL (Service will have read access)
- All dlls use .Net 4.0 framework
- We're using System.Reflection

Here is what I came up with:
Read More