Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Building Brokered LOB WinRT App's, a Quick Guide and a Few Tips to Help You Keep Your Hair

DZone's Guide to

Building Brokered LOB WinRT App's, a Quick Guide and a Few Tips to Help You Keep Your Hair

·
Free Resource

Diederik Krols - Building Enterprise apps using Brokered Windows Runtime Components

This article shows step by step how to connect a side-loaded modern app to a legacy component via the “Brokered Windows Runtime Components for Side-Loaded applications” feature. This feature comes with Windows 8.1 Update and allows Modern apps to break outside the AppContainer and connect to desktop components such as legacy .NET class libraries. This gives the side-loaded app direct access to native platform capabilities, including COM Interop and P/Invoke. For a detailed introduction I would encourage you to take a look at this Build 2014 session by @devhawk and read this MSDN white paper. A Brokered Windows Runtime Component is a new type of component that bridges the technology gap between the Windows Runtime and the .NET world. It allows you to write a touch optimized modern Store app against legacy components that sit on the same desktop. As an example I created a legacy application with a data access layer DLL that uses SQL Server Express and Linq-to-SQL, and a Windows forms executable:

image

I tried for a couple of hours to build and link the necessary components the manual way, as explained in the White Paper. But I’m not really skilled in building Runtime Components, and the last time I saw the internals of a C++ project was a very long time ago in a galaxy far away. When I was about to give up, the Brokered WinRT Component Project Templates for Visual Studio were released. And this is what happened then:

...

The side-loaded app can not directly talk to the Brokered Component since it’s targeting a different framework family. The following happens when you try this out:

...

There needs to be a so called Brokered ProxySub in between the Modern app and the Brokered Windows Runtime Component. Fortunately there is a template for this:

...

If you run the app now, it still goes wrong:

...

You have to make sure that ...

...

Brokered Windows Runtime Components will enable the development of a new breed of corporate line-of-business apps: touch-first modern apps that are connected to existing enterprise data and processes.

Here’s the sample app, it was written with Visual Studio 2013 Update 2 (RC) for Windows 8.1 Update. If you want to play with it, don’t forget to run as Adminstrator and change the path in the app’s manifest:

..."

As I've whined before (um... yesterday I think), there still needs to be allot done to help make Modern App's truly viable in the LOB world, but this is still one good step toward making a Modern LOB app workable. No one really wants to HAVE to rewrite our entire LOB stack (okay, we, dev's, usually want to rewrite it, but not to have to... ;). Re-use is good and this will help us do that. Now to see how it fares in the real world.

Related Past Post XRef: 
LOB help in the WinRT world - "Brokered WinRT Component Project Templates"

Topics:

Published at DZone with permission of Greg Duncan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}