IOC not initialized?
Issue #5
closed
It appears to me that any attempt to use the IOC will always result in this code:
FGetInstance := function(Service: PTypeInfo; Key: string): TValue
begin
raise EInvalidOperationException.Create('IoC is not initialized.');
end;
being executed.
Or, put another way, anytime you try to use the [Security('foo')] attribute, you'll get the exception above.
I can find no way to initialize the IOC.....?
Or am I missing something?
Comments (3)
-
Account Deleted -
Account Deleted Marko --
All that just to use the [Security] attribute? Yikes!
Thanks -- I'll look into it.
-
Account Deleted You could also provide you own TSecurityAspect implementation by copying unit DSharp.Aspects.Security and writing your own password validation (the current one seems like it is written for demo purposes - it uses hard-coded passwords).
- Log in to comment
IoC is a static entity used for service location and must be initialized to be used.
If you are building a typical MVVM application then the following line will initialize the framework (including IoC) by running the default bootstrapper (TSpringBootstrapper<TRootModel>).
If you are not running your application in this way then you need to configure IoC before using it. You have to initialize these methods:
Take a look into DSharp.PresentationModel.SpringBootstrapper.pas and DSharp.PresentationModel.Bootstrapper.pas to see how we initialize it with spring container.