Interfaces in Business Central: Enums, Testing, and Extensions
Автор: Stefan Maron
Загружено: 2024-10-13
Просмотров: 431
Описание:
Interfaces in AL cause confusion even for experienced Business Central developers, so this stream does a full walkthrough from first principles to production patterns. Starting with the basic contract concept — declaring an interface, implementing it in a codeunit, and using an interface-typed variable — you can see exactly why the "Interface not initialized" error happens and how to avoid it.
The enum + interface combination is where things get practical. Using DefaultImplementation and UnknownValueImplementation on extensible enums removes scattered case statements from your codebase entirely. Any extension can add a new enum value with its own implementation without touching your app, and the runtime resolves the correct codeunit automatically. The stream also covers the testability angle: extracting logic behind an InvoiceCreator interface lets you pass a FakeInvoiceCreator in AL unit tests, verifying orchestration logic without any database preconditions.
The session also looks at real examples from the BC base application — the Email Connector interface in the System Application — and covers the interface extension syntax introduced in BC v25, which lets you add procedures to a published interface without breaking existing implementors.
Streaming all kinds of coding for Microsoft Dynamics 365 Business Central.
Join me to just hang out or tell me what I am doing wrong ;)
Join me live and let's build this together.
📝 Blog post: https://stefanmaron.com/posts/interfa...
====== Content of this Video ======
0:00 - Introduction and Audio Setup
1:39 - Overview of Interfaces in Business Central
2:32 - Creating a Basic Car Code Unit
4:19 - Introducing the Vehicle Interface
5:58 - Setting Up a Test Page Extension
8:03 - Implementing the Vehicle Interface
10:00 - Initializing and Using Interfaces
13:57 - Using Enums with Interfaces
16:56 - Creating a Setup Page for Vehicle Selection
20:48 - Default and Unknown Value Implementations
24:52 - Advanced Use Cases for Interfaces
28:59 - Creating a Sales Invoice Example
31:31 - Breaking Down the Invoice Creation Process
34:48 - Creating a Fake Invoice Creator for Testing
37:32 - Overloading and Default Implementations
39:06 - Creating Interfaces for Individual Functions
41:33 - Factory Pattern and Customizable Behavior
42:44 - Exploring Interfaces in Base Application
45:29 - Extending Interfaces in BC v25
46:46 - Conclusion and Q&A
About Me:
https://stefanmaron.com/
Music by:
/ @streambeatsbyharrisheller
https://open.spotify.com/artist/6GTRL...
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: