Need some clarification regarding data portal changes #2632
-
I am working on understanding the changes to the data portal and need some help. Firstly, I have the following code in my BusinessBase or similarly in another Base:
How do we do this now? We no longer have a constructor, not even a private one, that can get the IDataPortal from DI. Do we need to create IDataPortal in the Task? If so how, as the ApplicationContext is not available in the static methods? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Static factory methods are no longer an option. Your choices are to inject (or create) a For the most part, you'll find that your UI elements (page/form/etc.) are created via DI, and so you can just inject the |
Beta Was this translation helpful? Give feedback.
Static factory methods are no longer an option.
Your choices are to inject (or create) a
DataPortal<T>
instance and use it, or put your static factory methods into a factory class (so they become instance methods of that class) and inject theDataPortal<T>
into that class.For the most part, you'll find that your UI elements (page/form/etc.) are created via DI, and so you can just inject the
DataPortal<T>
you need into the page/form and use it to interact with your domain objects.