Migrating your code

Preface

With every release of the runtime libraries, designer and accompanying template sets new features are added and changes are made to fix bugs or design flaws. While we do everything we can to avoid breakage of your code, some changes are unavoidable. This section illustrates some important points to consider when you move your own code using the LLBLGen Pro generated code to the v4.0 templates and updated runtime libraries (version number: 4.0.0.0).

Before you proceed, please read the following important notice:

note Important:
Please make backup copies of your work before migrating to v4.0. That is: make backups of your own code and the generated code before using LLBLGen Pro v4.0. This way you can roll back to your original work and continue working with 3.5 or earlier versions if you decide that migration to v4.0 requires more work than you anticipated and you have to complete it at a later date.


note Important:
If you're generating new v4.0 code on top of a project generated with v3.5 or earlier, it can be that when you load the project(s) into VS.NET, the references to the runtime libraries are still pointing to the v3.5 runtime libraries or earlier versions. Please make sure you manually update these references to the v4.0 runtime libraries, and if you're using .NET 3.5 or higher, be sure to remove the references to the LinqSupportClasses and QuerySpec assemblies as these are  now merged into the ORMSupportClasses assembly. See for more details about referencing the runtime libraries the section Compiling your code.

Furthermore, it's key to regenerate the code and also to check if you're indeed referencing the proper runtime libraries.

Below are the list of breaking changes in every 2.x version, v3.0, v3.1, 3.5 as well as the current version, v4.0. If you're migrating from version X to v4.0, be sure you read all the breaking changes on this page starting with the version following X up till v3.5 included. If you run into a breaking change which isn't enlisted here, please let us know so we can add it here.

Migrating generated code from version v3.5 to v4.0 runtime libraries

To make migration as smooth as possible, perform the following steps:

Breaking changes v4.0

The following breaking changes have been introduced in LLBLGen Pro Runtime Framework v4.0. They are a result of refactoring a lot of code of the entity classes and related classes of both Adapter and SelfServicing for faster fetch operations. In general these breaking changes aren't affecting most users, only the people who have extended some classes or overriden the methods affected. Correcting these changes is easy and straight forward.

General breaking changes
Breaking changes related to refactor EntityFields for faster fetches
How to work with the EntityFields(2) objects without using entity fields in an entity

If your code accesses the entity field objects in e.g. validators or auditors, instead of reading field properties, you can now access the values you need directly from the entity.Fields object through its IEntityFieldsCore interface, instead of obtaining the EntityField(2) object and access its properties. The reason you should use IEntityFieldsCore's methods instead of obtaining a field object from the Fields object is that entity objects no longer create entity field objects by default. They use a new internal object which is more efficient and allows faster entity materialization after a fetch. When you use entity.Fields[index] the Fields object will create a new field object for you on the fly, through which you can access the information you needed. However creating this field object is unnecessary.

In general this means you should use methods like entity.Fields.GetCurrentValue(index) instead of entity.Fields[index].CurrentValue. The latter still works, but creates an EntityField(2) object, the former doesn't. Please see for details about the IEntityFieldsCore interface, the LLBLGen Pro Runtime Framework Reference Manual (LLBLGenPro.RTL.ReferenceManual.chm).

LinqSupportClasses and QuerySpec assemblies are now merged into ORMSupportClasses assembly

Starting with v4, the SD.LLBLGen.Pro.LinqSupportClasses assembly and the SD.LLBLGen.Pro.QuerySpec assembly are now merged into the SD.LLBLGen.Pro.ORMSupportClasses assembly. This makes things easier when referencing assemblies. If you migrate an existing v2.6 or v3.x code base to v4, you have make sure the references to the LinqSupportClasses and QuerySpec assemblies are removed as they're no longer needed.

.NET 3.5 or higher is now required; no more support for .NET 2.0 or .NET 3.0.

Starting with v4, the LLBLGen Pro runtime framework is compiled against .NET 3.5, and your software therefore requires .NET 3.5 as well. If you're migrating an existing code base to v4, you have to adjust the target framework in Visual Studio to at least .NET 3.5

SD.LLBLGen.Pro.ORMSupportClasses and DQE assemblies no longer have .NETxy suffix in file/assembly name

Starting with v4, the ORMSupportClasses and DQE assemblies no longer have a .NETxy suffix in the assembly and file name. If you specify the assembly names for references in webforms, you have to adjust them so they don't contain '.NET20' anymore.

SD.LLBLGen.Pro.ODataSupportClasses is now compiled against v5.3 of the WCF Data Services Server assembly

Starting with v4, the ODataSupportClasses have been compiled against v5.3 of the WCF Data Services Server assembly available from nuget, instead of the .NET 4 version of the same assembly. Your application will therefore need to reference this same assembly (or newer) to use ODataSupportClasses. The advantage is that you get OData v3 support out of the box, while still are able to use OData v1 and v2.

TDL Interpreter / parser code freeze

Starting with v4, no new functionality, except some small changes, has been added to the TDL interpreter / TDL parser. All new functionality will be written in .lpt templates. If you use the TDL interpreter in your templates, be aware that if you want to utilize new features like Table valued functions in your TDL templates you have to rewrite them in .lpt templates instead. It's possible to use an .lpt include template inside a TDL template.


Migrating generated code from version v3.1 to v3.5 runtime libraries

The following changes are breaking changes introduced by v3.5. Please check them with your own project to make the transition as smoothly as possible.

Breaking changes v3.5

The following breaking changes have been introduced in LLBLGen Pro Runtime Framework v3.5. They are a result of refactoring a lot of code of the entity classes and related classes of both Adapter and SelfServicing into a base class which is inherited by EntityBase and EntityBase2 so more code is re-used. In general these breaking changes aren't affecting most users, only the people who have extended some classes or overriden the methods affected. Correcting these changes is easy and straight forward.

Changed method signatures
No more COM+ support

All COM+ oriented code has been deprecated and is no longer included. This means that projects migrated to v3.5 and which are re-generated have to get rid of the COM+ based classes (automatic in Adapter, in SelfServicing, remove the TransactionComPlus helper class). COM+ using code should use System.Transactions instead.

ORMSupportClasses assembly is now split in two assemblies

To make the ORMSupportClasses and the generated code projects usable in .NET 4 client profile projects, we split up the ORMSupportClasses assembly into two assemblies:

The net effect is that for web projects migrated to v3.5 which use the datasource controls, the assembly name of the datasource declaration has to change from SD.LLBLGen.Pro.ORMSupportClasses.NET20 to SD.LLBLGen.Pro.ORMSupportClasses.Web. Additionally, the version has to be adjusted to v3.5.0.0.

In general this change has to be made in the web.config file of the website. It's recommended to register the tag prefix 'llblgenpro' in the web.config file so you'll have the reference to the assembly in just 1 location, instead of on every page where a datasource control is used. In the case where the tag is registered on every page, the assembly name has to be changed in every <Register> element as described above.

To perform design-time actions, the datasource controls located in SD.LLBLGen.Pro.ORMSupportClasses.Web.dll have to be added to the toolbox, which makes them available when a webform is opened in VS.NET.

No more design time support for Entity Collection classes.

The Entity Collection classes no longer support design-time usage through a designer in VS.NET. In general it's not a good idea to drag an entity collection onto a Windows Form anyway, but in the past you could do so and, in adapter's case, get a designer which allowed you to pick the factory.

In v3.5 there's no longer design-time support for collections. In general this shouldn't be a big problem, as best practices say you should use the Data sources feature in VS.NET for this anyway: Instead of dragging/dropping an entity collection, configuring it at design time and at runtime filling it with data, do the following:

  1. Create a data source in the VS.NET project using the Data menu
  2. Select the entity type you want to bind through the data source
  3. Add a BindingSource to the form you want to bind entity data.
  4. Select the created data source as the DataSource of the binding source.
  5. Set the BindingSource as the DataSource of the control you want to bind to.
  6. At runtime, bind a new entity collection to the BindingSource instance by setting the DataSource property of the BindingSource to the entity collection instance:

    var toBind = new EntityCollection<CustomerEntity>();
    // fetch it
    ...
    // bind it to the bindingsource
    myBindingSource.DataSource = toBind;	

Projects migrated to v3.5 continue to work, but altering the design-time designed collections won't work as there aren't any designers anymore.

Obsolete methods

Migrating generated code from version v3.0 to v3.1 runtime libraries

The following changes are breaking changes introduced by v3.1. Please check them with your own project to make the transition as smoothly as possible.

Breaking changes v3.1

Templates
Runtime libraries

Migrating generated code from v2.6 to v3.0 runtime libraries

The following changes are breaking changes introduced by v3.0. Please check them with your own project to make the transition as smoothly as possible.

Features no longer supported in 3.0

The following features are no longer supported:

Breaking changes v3.0

Templates
Runtime Libraries

Migrating generated code from v2.5 to v2.6 runtime libraries

 A lot of the breaking changes are made on the .NET 2.0+ code only. This is due to the fact that the .NET 1.x codebase has reached its end of life (as well as the CF.NET 1.x code). LLBLGen Pro v2.6 does ship with .NET 1.x code support, but not a lot of the changes in v2.6 are made to that codebase as well. You're encouraged to upgrade to at least .NET 2.0.

Breaking changes v2.6

Runtime libraries
Templates, generated code.

Breaking changes v2.5

Runtime libraries
Templates

Migrating generated code from any previous version to 2.0.0.0 runtime libraries

You have to re-generate the code and recompile the generated code as well as to recompile your own code which references the runtime libraries of LLBLGen Pro (ORM Support Classes and / or DQE). Be sure you reference the new runtime libraries.

Your code will likely not compile at this point. Don't panic, we've created a list below with the important changes in the generated code / runtime libraries. The list is also important for code behavior changes at runtime as we made a small set of changes which could affect runtime behavior, as in: null reference exceptions because you access a property in your code which now returns null instead of a guaranteed value.

This guide assumes you're on 1.0.2005.1. If you're on an older version, you might run into one or two breaking changes depending on the current LLBLGen Pro version you're using, however in almost all cases these are compile time breakings, very rare and easy to fix. If you're using a lot of custom templates it might be you will run into more problems than which are listed below, which can be solved by updating your templates, which you have to do anyway due to the new template configuration system.

Breaking changes v2.0

General

Adapter specific

SelfServicing specific

Note: You can request the version of the runtime libraries you're currently using in your code using:

// C#
string version = SD.LLBLGen.Pro.ORMSupportClasses.RuntimeLibraryVersion.Version + "." + 
	SD.LLBLGen.Pro.ORMSupportClasses.RuntimeLibraryVersion.Build;
' VB.NET
Dim version As String = SD.LLBLGen.Pro.ORMSupportClasses.RuntimeLibraryVersion.Version & "." & _ 
	SD.LLBLGen.Pro.ORMSupportClasses.RuntimeLibraryVersion.Build

The runtime libraries have a file version attribute as well, besides the 2.6.0.0 version. You can request that version attribute's value by clicking with the right-mousebutton on the .dll and select 'Properties' and in the dialog that pops up, select the Version tab. The version format is: 2.6.08.mmdd.

LLBLGen Pro Runtime Framework v4.0 documentation. ©2013 Solutions Design bv