What's the difference between C# Code Fragments and Assembly TBBs?

后端 未结 5 1599
暖寄归人
暖寄归人 2021-02-13 02:59

I understand C# Code Fragments and .NET Assemblies offer the same functionality for modular template development. We manage the code fragments in the CME and assembly code in Vi

5条回答
  •  我寻月下人不归
    2021-02-13 03:47

    The main differences between C# code Fragment and .net Assemblies in my point of view are categorized into below high level buckets.

    Step-by-Step Debugging

    With .net assemblies you could do step-by-step debugging from visual studio where as C# Code fragments it is not possible.

    Re-Use or Base Classes

    With .net assemblies you could extend ITemplate to create something like BaseTemplate and all your template could extend them so you have common design pattern, where as C# there is no concept of BaseTemplate other than Tridion ITemplate interface.

    With .net assemblies you could add common utility classes (often TridionUtilities) and all your templates refer to the same TridionUtilities for common functionality. C# code fragment the utility functions need to be defined within the same TBB and cannot be reused with other TBBs unless you create a class and deploy to GAC.

    Easier Upgrade Scans and Maintenance

    With .net assemblies it is easier to do any upgrade scans like deprecated APIs/Methods simply referring to new dlls/.net framework. .net assemblies make it easy to identify potential impacts on planning either Tridion upgrades or .net framework upgrades. C# code fragments it is much harder to find the deprecated or any impacts of upgrade.

    Developer Friendly

    Obviously .net assemblies are developed using Visual Studio (developers love it!) vs. C# Code Fragments in a Text Editor (painful).

    When I started back with Tridion 5.3, started with C# code fragments and quickly realized what a mistake I made for not going .net assemblies.

    My vote is always .net assemblies and C# code fragments is not even in consideration unless I don't have a choice. lol..

提交回复
热议问题