OK 
 
 
    Start | MVPs 


        MVP Weblogs


door: Jan Karel Pieterse
Our All VBA treeview control for Office has been updated to build 024. We have now included properly working examples for Word and Access!
comments 5/20/2013 4:10:00 PM

door: FransBouma

This is the first post of a series about the new features in LLBLGen Pro v4.0, which was released on April 6th, 2013. Starting with v4.0, the LLBLGen Pro designer is usable both as standalone (as it was before) and as an integrated designer in Visual Studio. I'll explain in this article what this integration is all about and what we had to do to make it work. If you want to know more about how to use this feature, please check out the manual page on this feature.

So how does this integration look like? Below is a screenshot from the manual:

It almost looks like the stand-alone designer, eh? Winking smileIntegrating in Visual Studio can be done in several ways: through e.g. a plug-in/add-in, an extension to the editor or a Visual Studio extension. Our integration is done through a Visual Studio extension (VSIX).

How the integration works, user perspective

When you start Visual Studio, the extension isn't visible: no menus, no tool windows, no tool bars. When you load an LLBLGen Pro project (a file with the extension '.llblgenproj') into Visual Studio, or create a new one inside Visual Studio using the normal item creation system, the designer is loaded inside Visual Studio: all panes are opened as tool windows and the project file itself is opened as a document editor inside the document well (central tab area) of Visual Studio. When this document editor, which is a single tab inside the document well, has the focus, the toolbar and menu are visible, and the project's contents is visible in the various tool windows (see screen shot above).

Opening another LLBLGen Pro project inside Visual Studio opens another document editor, but no extra tool windows. Instead, the contents of the tool windows is switched when you switch between document editors so they always show the project contents of the document editor which has focus. For a background on this, please see the section below called 'How we wrote the VSIX'.

Generating code will add the generated VS.NET projects to the loaded solution, if they're not already present there. This way of working as the advantage that you don't have to leave VS.NET to work with the designer, you can add the LLBLGen Pro project to your solution as a bonus don't have to manually add the generated code to your solution.

All functionality, except imports (see below) is the same as with the stand-alone designer, as the stand-alone designer is actually loaded inside Visual Studio and its parts are displayed within the IDE.

How we wrote the VSIX (or: how to lose your hair in 2 months)

Visual Studio is mainly an IDE around editing files: a file is opened with the associated editor of the file's extension in the document well and the editor associated with the file's extension can open 0 or more tool windows and do other things. You can of course open tool windows inside the document well which edit 'objects' and not 'files', however this isn't as simple as it sounds. And precisely that was a problem we had to solve: our designer is also an IDE with a central tab area but instead of opening files in that tab area, we open editors of objects.

To make Visual Studio work like our designer, we were forced to go what I'd call, 'the All-In' route: create custom project types for Visual Studio, rewrite our project explorer to build objects in the Solution Explorer in Visual Studio, open custom tool windows inside the document well of Visual Studio for each object edited. We quickly learned that creating an extension to Visual Studio is not a walk in the park: the code isn't that complex, it's the lack of serious documentation, examples and above all, the quirks of the IDE which made it a big a project to complete. Looking at the work for the All-in variant, we decided to go for the alternative: create a file-extension bound editor. Looking back this was a wise decision, as this extension too took us a long time to create, almost two months. 

With v3.0, released in early 2010, we designed the designer to be modular so it wouldn't be to much work to make it usable from within another application, e.g. Visual Studio. The UI is broken up in several parts and all designer logic is structured in an event-oriented system with several controllers on top. The advantage of this is that whenever something happens inside the UI, one or more events are raised and observers to these events (or the events as result of these events) are picking them up and act accordingly. These observers are all located outside the UI. The main advantage of this is that even though the designer in stand-alone form looks like an MDI window with tool windows docked inside it, the control of these docked windows and what happens inside them is not within the MDI window.

The v4.0 designer is a successor of v3's so with the modular design at hand we decided to create a Visual Studio extension tied to the LLBLGen Pro project file file-extension '.llblgenproj'. In Visual Studio terms: a custom document editor. A Visual Studio extension is actually a Visual Studio package, packed in the form of an 'extension'. The extension contains of the following parts:

  • Each docked 'pane' in the designer is opened as a Visual Studio Tool window and docked inside the IDE
  • The document well of the designer is opened as a Visual Studio Document Editor in the document well.
  • The toolbar is created as a button bar inside Visual Studio
  • The menus are pivoted into a single menu in the main menu of Visual Studio
  • A factory which produces new document editors

To achieve this, we wrote an extension which loads the standalone designer into Visual Studio, and instead of telling it to open an MDI window and dock some panes into it, it simply tells the loaded designer to hand the pane windows and its own window to the extension object. The extension object then opens the Visual Studio tool windows and its main editor and there you are: integrated inside Visual Studio.

Simple? Well… not quite.

The fun starts with where Visual Studio extensions are located. There are two locations: inside the user's My Documents folder and inside the Visual Studio installation folder. Both locations are not ideal if you want your code to also be usable as stand-alone. The trick was to create a registry key at installation which is read by the Visual Studio extension which points to the folder where LLBLGen Pro was installed. I tried numerous things, including junctions but these all failed. The registry key is easy enough though.

The next problem was something we never had to run into before: what if multiple LLBLGen Pro projects are opened inside Visual Studio? Although opening multiple LLBLGen Pro projects will open multiple instances of the designer, without separating the AppDomains, we'd run into problems where statics were suddenly shared among instances. However, creating a new AppDomain per instance wouldn't work as that would require the editor panes we would like to show inside the designer to serializable, which isn't possible. Luckily we had grouped all statics inside objects which lived in a few singletons which act as Services inside our designer.

Whenever a designer instance was loaded into the extension, we assigned to it an ID and we'd request an object we dubbed integration controller from the designer, which would act like the controller of the designer and data exchange. Through this controller we also could tell the designer instance which document editor instance was active. The services/singletons then switched their state to the instance ID passed to the integration controller and all code of the designer and its sub-systems would think they were running inside the stand-alone version.

This state-switching also helped with the tool windows of Visual Studio: by default each Visual Studio tool window is created just once. You can create multiple instances if you must, but you'll soon learn that multiple instances of a tool window makes things less usable. So each time a document editor became active inside the IDE, the document editor would get called by the IDE and we simply made the extension to update the associated designer's state to the one associated with the document editor's ID and as well update the tool windows to the ones of the designer instance associated with the ID.

On to undo-redo. Our own designer has a full undo-redo system, based on our OSS library Algorithmia (available on github), and so does VS.NET. Of course these aren't compatible with each other however the designer's undo-redo should work in sync with the VS.NET undo-redo system. After looking into making things compatible for a few days, it occurred to me it doesn't matter: whenever a user does something through the document editor, the IDE will query your editor if the undo/redo state of the buttons should change. Our designer already kept track of that, so simply returning this state was enough. Whenever the user pressed the undo/redo buttons (or the keystrokes) inside the IDE, the document editor with focus got a call which was passed through to the integration controller to do the actual undo/redo on the model, similar to if the user would undo/redo in the stand-alone designer.

Undo-redo is a global system, however with multiple instances, there are multiple undo/redo stacks active at once, one per instance. Algorithmia's undo/redo system is able to work with that: it works with 'scopes'. This means you can have local undo/redo separated from the global undo/redo. We utilize this in the integration so each designer instance is a separate scope inside the undo/redo system, so undo/redo information isn't shared.

The last problem I'd like to address is installation. Visual Studio extensions, VSIXs, can be installed in two ways: you either dump all files in a folder in one of the two extension locations and let VS.NET know some extension installation took place or you wrap your code inside a .vsix file. The latter has as advantage that registration of your extension is done for you without a slow re-scan of the complete extension folders. It also takes care of locating the extensions folders. I first looked at the former alternative, as we use our own installer but the logic to locate the folders and install everything in both 2010 and 2012 was a pain, and everything was taken care of with a .vsix file: we simply run it silently during installation and it installs the extension in both 2010 and 2012 if present, in the right folder and registers the extension as well.

Was it all worth it?

Yes. Developing this extension was a true pain, I'd be lying if I called it something else, but as a tool / framework developer it's part of our job to write the painful code so our customers don't have to; that's why they pay for a license. In the end, I can only say I'm very pleased with the result and have heard only positive feedback from users, so in short: yes it was worth it.

As I said above, creating a Visual Studio extension isn't a walk in the park: using .NET for an extension is possible, the SDK looks OK, the starter project gives you a lot of code to start with, but after a short while you'll learn that below this thin layer of chrome, the actual metal is pretty rusty and shows its true age. The technical debt of the C/C++/COM based system is so big, I doubt it will ever get better, especially as there's little incentive to do so: the biggest 'customer' of VS.NET's integration system is Microsoft itself, and as we all know internal code is more rough, less documented than software that's delivered to customers outside the company.

If you're planning to develop your own Visual Studio extension, be aware of the fact you'll spend a lot of time cursing the IDE, it's long list of quirks and inconsistencies, missing docs and serious lack of examples how to do things: you'll run into many posts with similar questions as yours but with no or unusable answers. You're entitled to throw your hands into the air and scream the filthiest curse words in the direction of Redmond, but that won't get you near your goal. As an engineer, you have to think and act like one: write some prototype code and attach a debugger in another VS.NET instance to your test VS.NET instance to see what's happening, what's called when you do X.

It will be a struggle at first, but you'll get there: and you'll have to do it yourself, there's no-one out there to help you. But hey, that's the life of an engineer.

Winking smile


comments 5/13/2013 12:32:29 PM

door: Jan Karel Pieterse
RefTreeAnalyser 2.0 has just been updated. Now you can change the hotkeys. People who are using version 2 will be automatically prompted for this update. Ever had to work out the logic of other people's Excel files? Ever had to untie the spaghetti-knots of a large Excel workbook's formulas? Then you know what a nightmare this can be! Now there is the RefTreeAnalyser! With this tool, finding out how a cell in a workbook derives its results and what other cells depend on the cell is a breeze.
comments 5/3/2013 4:00:00 PM

door: Jan Karel Pieterse
Anyone who places an order between April 30, 2013, 8:00 AM GMT and May 1st, 2013 8:00 AM GMT will receive a 50 % rebate on the list price. I'm also going to give away some of the licenses: I'll randomly select 1 out of every 10 orders placed in that period of time These people will receive a complimentary license.
comments 4/29/2013 9:40:00 PM

door: Jan Karel Pieterse
Koninginnedag uitverkoop! Alle bestellingen geplaatst tussen 30 april 10:00 's morgens en 1 mei 10:00 uur 's morgens (Nederlandse zomertijd) krijgen 50 procent korting. Bovendien verloot ik een gratis licentie per 10 geplaatste bestellingen.
comments 4/29/2013 9:40:00 PM

door: Jan Karel Pieterse
RefTreeAnalyser has been completely updated to version 2.0. This new version also works on the 64 bit versions of Office. Ever had to work out the logic of other people's Excel files? Ever had to untie the spaghetti-knots of a large Excel workbook's formulas? Then you know what a nightmare this can be! Now there is the RefTreeAnalyser! With this tool, finding out how a cell in a workbook derives its results and what other cells depend on the cell is a breeze.
comments 4/24/2013 6:25:00 PM

door: FransBouma

I'm proud to announce we've released v4.0 of LLBLGen Pro! This release is the 13th full release we've done and it arrives in the year LLBLGen Pro turns 10. As always we've packed the new release with great new features and I hope we've added what you wanted us to add. You can find what's new here: http://www.llblgen.com/pages/whatsnew.aspx

Not only did we add new features, we also introduced something else: Lite.

Lite

LLBLGen Pro Lite is a free version of LLBLGen Pro. It packs all the features of the full version, however it comes with a limitation: an entity model is limited to 8 entities per model and it also come with no support. It's free as in beer and you can use the generated code in production.

Upgrades

V3.x users can upgrade with a 30% discount, by logging into the customer area.


comments 4/8/2013 11:48:08 AM

door: Jan Karel Pieterse
Our All VBA treeview control for Office has been updated to build 021.
comments 3/14/2013 2:10:00 PM

door: FransBouma


We've released the first beta of LLBLGen Pro v4.0! We hope you all like the new features and additions we packed into this new release! To make sure stuff is truly tested in a lot of scenario's, the beta is available to all v3.x licensees.

How to get the beta
Log into the customer area, then select 'v3.5' from the Downloads menu and navigate on the downloads page to 'Betas'. No license is required, the beta license is included in the installer.

Installation
Run the installer as administrator. It will automatically install the VS.NET extension to use the designer inside VS.NET in VS.NET 2010 and VS.NET 2012 (pro and up), if available. Of course the designer is also usable as stand-alone, outside VS.NET.
The installer will start the VSIX (visual studio extension) installer at the end of the normal install. It might be the VSIX installer is still running when the normal installer ends. If you have VS.NET open when you install the beta, you'll have to close VS.NET and restart VS.NET to see the add-in.
You can install the beta side-by-side with older versions of LLBLGen Pro. V4's file format is compatible with v3, however a v4 file which is loaded into v3 and saved in v3 will lose v4 specific data.

Documentation
We included a word document with the details about this beta, which features are included and how to use them. This document, called LLBLGen Pro v4.0 beta readme.docx, is installed in the LLBLGen Pro v4 beta installation.

How to provide feedback
Please provide all feedback in the beta forum: http://www.llblgen.com/tinyforum/Threads.aspx?ForumID=52

What's new in V4.0
The list below is the global list of what's new in V4. The enclosed word document has the fine details of these new features and changes and also details of minor changes and new features not listed below.

Designer

  • Full Visual Studio integration (VS.NET 2010 / 2012)
  • Table Valued Functions support (EF/Linq to Sql/LLBLGen Pro RTF)
  • Additional interfaces/namespaces now use the rule system
  • Update / Delete rules for FK constraints (Cascade delete/update)
  • SQL Server 2012 sequence support (LLBLGen Pro RTF/NHibernate)
  • Action suggestions window
  • Custom type shortcuts can now have default length/precision
  • The designer is now a .NET 4.0 application, no more .net 4 runners.
  • Char <-> String system type converter
  • Re-scan of enum typeimport files without closing designer

Runtime Framework

  • Table Valued Functions support
  • Query result cache
  • Much faster entity fetches
  • Inlining DDD value types
  • SQL Server 2012 sequence support
  • Data Scopes (see https://github.com/SolutionsDesign/LLBLGenProExamples_4.0)
  • Xml Serializability of entire query API
  • True skip / offset
  • Fetch typed lists with QuerySpec
  • Runtime libraries are now built against .NET 3.5
  • QuerySpec and Linq assemblies are merged into ORMSupport Classes
  • OData support classes are now built against WCF Data Services 5.3 and support OData v3

I'm especially pleased with the VS.NET integration which turned out to be very nice, the TVF support, the much faster query fetches, the query result cache and the DataScopes. Please check out the example available at github (like above) how little code it takes to make a typical LoB application with the new DataScopes.


comments 3/7/2013 5:35:59 PM

door: Jan Karel Pieterse
We have created a treeview for Office VBA that will work on any version of Office as of Office 2000, including 64 bits and MAC Office! If you have ever used the Treeview control from the "Additional controls" section, then you know what a versatile control this is to show hierarchically organized data. There are a couple of problems with this Treeview control: You risk compile errors and -worse- it will not work on 64 bit Office..
comments 2/21/2013 3:30:00 PM

door: Jan Karel Pieterse
I've updated Autosafe with new translations for German.
comments 1/29/2013 4:30:00 PM

door: FransBouma

This post is a reply to Scott Hanselman’s post: "You’re not your code"

There are no two programmers in the world who like each others code, there's always criticism: "I would have done this differently" or worse "Whoa, dude, never heard of SOLID? Where are the tests for this?". IMHO, criticism is OK, as long as it's based on well founded arguments and they make the original programmer of the criticized code learn new things. I don't think Scott's post is about that.

I think Scott refers to this: simply bitching about someone else's code because you'd have implemented the same program much better, as you see yourself as a great developer is stupid.

I'd like to make an addition to that: if you think you're a great developer and express yourself in that fashion, and your professional code is not code one can expect from a professional (i.e. code which is maintainable, without (most of the) bugs, it's well documented etc.), you're a fraud and it's a little bit different: you tried to sell the idea that your hack, your hobby code is professional code. 

However, not all code is professional code. Sometimes we simply hack something together to make something happen 1 time, or only for a single user (ourselves). For example internally here I use a change log system in where I log changes made to the various parts of the tools we produce. This is a very rudimentary piece of software, with a tremendously ugly UI, buggy event handlers and the databinding sometimes gets confused. This is because I wrote it in one afternoon, no tests, no design thoughts, just started hammering in code and when it compiled without errors I said "Done!".

But it works, it gets the job done of what I want to do: log the change made into a database so I can sync it with the online change log on our website so users can browse the change log online. Every time I run into a bug (which isn't often, as I know what to click and do) in this marvelous piece of code (ahum) I say to myself "it might be better if I fix this some day", but as the only time I use this software is when I have to do a push of a new build, this 'some day' is not today.

If this software would ever be released somewhere in source-code form, it will likely be bashed to pieces. If I would release it as source-code with the remark 'great system to log your changes and sync with online database', the bashing would IMHO be justified. But as it's a tool which is only for myself, and if I would release it as 'Dunno if this helps anyone, it works for me, have fun' and a bigwig would bash it to pieces because he's holier than me, that bashing IMHO wouldn't be justified: it's a hack, not professional software.

Bashing a hack released as a hack is stupid. Bashing a hack released as professional code isn't, as it exposes the hack as what it truly is: a hack.

Question of course is: when is a piece of code a hack / hobby code and when does it become professional code? IMHO the variety of answers to that question will tell you why the bashing of other people's code will continue no matter what and why there will never be two programmers in the world who like each others code without criticism.

Though we can do something. As it's difficult to determine when a piece of software is a hack if it's not described as such (not by one person but as a general qualification: if piece of software A is declared a hack, everyone will agree it is in fact crap), we as developers could keep that in mind when we use our bash-hammer on some piece of code we found online somewhere: what is truly gained from our criticism? Will the world be a better place? Will the software magically become better? Or is it just about our own ego that by declaring piece of software A a true example of crapcode, our own code must be much better?

The main reason we have to take that in mind is because we are our code. Well, not entirely, but we did write it. An outsider won't know whether we poured our soul into it and that we invested precious time in it. Bashing it to pieces because the fruits of our hard work is seen as a hack while it's not is going to hurt. If it doesn't hurt, you're not caring enough about the quality of your work, or they might have been right: your work was a hack after all, it didn't exceed the hobby code bar.


comments 1/25/2013 11:26:32 AM

door: Jan Karel Pieterse
RefTreeAnalyser has been updated. I have changed how hidden sheets are handled (no more messageboxes). Do you have a license? Then get this free download to update! Ever had to work out the logic of other people's Excel files? Ever had to untie the spaghetti-knots of a large Excel workbook's formulas? Then you know what a nightmare this can be! Now there is the RefTreeAnalyser! With this tool, finding out how a cell in a workbook derives its results and what other cells depend on the cell is a breeze.
comments 1/2/2013 3:05:00 PM

door: Jan Karel Pieterse
With the introduction of Excel 2013, Microsoft changed the windowing of Excel. On all previous versions, Excel had a so-called Multiple Document Interface (MDI), which means all open Excel files are hosted by one Excel application window. Excel 2013 introduced a Single Document Interface, meaning each workbook appears in its own Excel window. This new feature of Excel causes some trouble with modeless userforms. This article shows you how to resolve the issues involved.
comments 11/26/2012 3:45:00 PM

door: Jan Karel Pieterse
My free Flexfind tool for Excel has been updated to build 577. It now properly keeps its dialog on top of all Excel 2013 windows.
comments 11/21/2012 3:55:00 PM