Thank you for your reply!
Your information did help me solve the problem after all!
Although it was not the only bit that had to be edited to make it all work. There also is the file Web.Host\wwwroot\swagger\ui\index.html that has to be edited - it references two files using absolute paths:
<script src="/project-name/swagger/ui/abp.js"></script>
<script src="/project-name/swagger/ui/abp.swagger.js"></script>
Maybe, this information should/could be included to the ticket you linked!?
Anyway, thank you very much for your help!
It finally works!
I simply dependency-inject IocManager to my Hub, there i can then resolve all other dependencies.
Startup.cs
GlobalHost.DependencyResolver.Register(typeof(MySignalRHub), () => new MySignalRHub(IocManager.Instance));
MySignalRHub.cs
private readonly IIocManager _iocManager;
public MySignalRHub(IIocManager iocManager)
{
_iocManager = iocManager;
}
public async Task SomeMethod()
{
using (var scope = _iocManager.CreateScope())
{
var repClassA = scope.Resolve<IRepository<ClassA>>();
var srvClassA = scope.Resolve<IClassAAppService>();
// ...
}
}
I managed to figure out that the Internal Server Error has to do with my Hub class using dependency injection. So, I tried to register my Hub class and its dependencies in Startup.cs using GlobalHost.DependencyResolver. So far, my Client is able to invoke the hub method correctly. But the hub method itself fails when accessing the dependencies - they are all null … it's the same when I try to resolve dependencies in hub class constructor …
How do I resolve dependencies in a hub class correctly?
<cite>maliming: </cite> This is not recommended. If you can migrate SignalR to SignalR Core, it's best.
Thanks for your reply! I already thought so :lol: Well, it would be for a short period of time only (a couple of days) - just till all clients have updated to the latest version, speaking AspNetCore.SignalR finally.
So, even if it is not recommended, I'd still like to do it - it would make the upgrade process a lot smoother. But if it is not possible at all, then I will have to figure out something else (the goal is to avoid IoT-Client downtime).
Solved!
Turns out the following line was missing in service-proxy.module.ts:
{ provide: HTTP_INTERCEPTORS, useClass: AbpHttpInterceptor, multi: true },
Seems like it didn't get merged correctly from the upgrade-branch to the development-branch. Or maybe I did it by hand and simply overlooked ...
Anyway, it's working now :)
FYI, I used source-control explorer (Visual Studio Team Services) to simply compare the difference between upgrade-branch and development-branch. This way I was able to find the missing line of code quite fast :)
BTW: Should you ever want to visualize your Angular project dependencies, here's a sweet tool called NGD: [https://github.com/compodoc/ngd]).
Hello everybody!
Okay, here is what I did to get a Reduced Angular Client. I'm still in development process and so far I didn't encounter any problems with the way I edited the original ASPNETZERO Angular Project. But still, I'm not a hundred percent sure whether my approach is clean enough as there are some libraries remaining.
NOTE: My goal was to keep the Angular project updateablbe/upgradeable, so I basically commented out everything I didn't need. Modules and their Components I wanted to get rid of are: Account, App (including Admin and Main). Also I wanted to get rid of Metronic and use Bootstrap-Material-Design [https://fezvrasta.github.io/bootstrap-material-design/]) instead, as well as using flag-icon-css [http://flag-icon-css.lip.is/]) for language selection.
Also NOTE: This is Angular Client Version 5.0.0
.angular-cli.json This file is responsible for importing third party libraries and os on. I started out here, made a copy of the file to keep the original safe and started removing libraries I thought I'm not going to need. This is what I ended up with:
"styles" [list:2io0ubpc] bootstrap-material-design font-awesome leaflet flag-icon-css styles
"scripts"
jquery jquery-validate popper bootstrap-material-design js.cookie jquery.timeago jquery.signalR localforage spin jquery.spin jquery.blockUI moment-with-locales moment-timezone-with-data url abp abp.jquery abp.blockUI abp.spin abp.moment jquery.mousewheel jquery.inputmask.bundle
[/list:u:2io0ubpc]
Next I wanted to get rid of all Modules. Here is what I did to accomplish that goal (by file):
/src/root.module.ts
Added Imports [list:2io0ubpc] import { AppPublicModule } from "./app-public/app-public.module"; // custom module
Commented out Imports
//import { AppModule } from './app/app.module'; //import { UrlHelper } from '@shared/helpers/UrlHelper'; //import { AppAuthService } from '@app/shared/common/auth/app-auth.service'; //import { AppUiCustomizationService } from '@shared/common/ui/app-ui-customization.service';
Comment out all parts of code that have errors caused by the commented out Imports! [/list:u:2io0ubpc]
/src/root-routing.module.ts
Commented out Imports [list:2io0ubpc] //import { AppUiCustomizationService } from '@shared/common/ui/app-ui-customization.service';
Comment out all parts of code that have errors caused by the commented out Imports! routes
Comment out all routes Add custom routes
[/list:u:2io0ubpc]
/src/account/account.module.ts
comment out everything
/src/app/app.module.ts
comment out everything
/src/app/app.component.ts
comment out everything
/src/app/app.component.spec.ts
comment out everything
/src/app/app-routing.module.ts
comment out everything
/src/app/index.ts
comment out everything
/src/shared/common/common.module.ts
Commented out Imports [list:2io0ubpc] //import { AppUiCustomizationService } from './ui/app-ui-customization.service';
Comment out all parts of code that have errors caused by the commented out Imports! [/list:u:2io0ubpc]
/src/shared/common/app-component-base.ts
Commented out Imports [list:2io0ubpc] //import { AppUiCustomizationService } from '@shared/common/ui/app-ui-customization.service';
Comment out all parts of code that have errors caused by the commented out Imports! [/list:u:2io0ubpc]
/src/shared/helpers/LocalizedResourceHelpers.ts (Angular Client Version > 5.0.0)
loadLocalizedStylesForTheme() [list:2io0ubpc] comment out all $('head').append() related to metronic and primeng
[/list:u:2io0ubpc]
/src/shared/service-proxies/service-proxy.module.ts
Providers [list:2io0ubpc] Comment out all of them Exceptions (do not comment them out): [list:2io0ubpc] ApiServiceProxies.LanguageServiceProxy ApiServiceProxies.SessionServiceProxy
Add custom service proxies [/list:u:2io0ubpc] [/list:u:2io0ubpc]
So far, this is what I did to reduce the client. I hope it is replicable enough. I you have any further questions feel free to ask. If you have ideas for improvement, please share!
I encountered some other problems with my original example: the way I declared the callback function that is used for subscribing and unsubscribing just wouldn't let me access any properties of my class. The declaration that now does work looks like this:
onGetUpdate = (data: MyClass) => {
this.item = data;
}
Just to let you know ;)
Oh, how could I just do it wrong :roll: :lol: Thanks a lot, @aaron !
Okay, so removing libraries I'm not going to use wasn't that hard after all. But of course I also want to remove all of the components that I'm not going to use - and this took me a while, although it turned out to not be too difficult after all. I just played around a bit trying to figure out what would be the best approach for me to reduce the ASP.NETZERO Angular client and keep it all updateable/upgradeable in case a new version of ASP.NETZERO gets published.
I'm confident that I found a good approach for me now! I'm happy to share my experience with you as soon as I'm done and sure everything still works as expected.
By then - have a nice Weekend :)