Base solution for your next web application

Activities of "th3monk3y"

Hi SomnathSwami, In my opinion that is not a good move. Keep your front end separate. This is what's called a separation of concerns.

What I did was turn the angular project (front end) into a VSCode project. I'm using nodeJS to launch chrome browser. There is an extension for VScode called Debugger for Chrome. Using this extension you are able to break in your typescript code. Package management is also much better going this route as you can open a terminal in VsCode much like package manager console in Visual Studio. I've included my VsCode debug configuration for anyone that's interested.

Hope this helps...

{
    // Use IntelliSense to learn about possible Node.js debug attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",

    "configurations": [
        {
            "name": "Launch Chrome against localhost, with sourcemaps",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:4200",
            // This forces chrome to run a brand new instance, allowing existing
            // chrome windows to stay open.
            "userDataDir": "${workspaceRoot}/.vscode/chrome",
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}",
            //"diagnosticLogging": true,
            "sourceMapPathOverrides": { "webpack:///./*": "${webRoot}/*" }
        },
        {
            "name": "Attach to Chrome, with sourcemaps",
            "type": "chrome",
            "request": "attach",
            "url": "http://localhost:4200",
            "port": 9222,
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}",
            "diagnosticLogging": true,
            "sourceMapPathOverrides": { "webpack:///./*": "${webRoot}/*" }
        }
    ]
}

I was able to resolve this by adding import to root-module.ts. Originally I had it in app.module.ts

Hope this helps someone else.

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

and then add reference in imports

@NgModule({ imports: [ BrowserModule, SharedModule.forRoot(), ModalModule.forRoot(), AbpModule, ServiceProxyModule, RootRoutingModule, BrowserAnimationsModule ],

So I thought I'd upgrade to angular 4 since they tout it as being a piece of cake. Well it's anything but that! :)

I'm on the final stretch but keep encountering the following error.

Uncaught (in promise): Error: Cannot activate an already activated outlet\nError: Cannot activate an already activated outlet\n

I have added the following import as suggested on the Angular 4 doc. import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

I have also updated to the latest abp-ng2-module 1.0.0

I know you guys ported the code to angular 4 so I am hoping you can help me out.

thanks in advance

Answer

If I am understanding you correctly, what you want to do is create a DTO with the data you need and then use AutoMapper to map the returned values from "GetAll" to your DTO.

Look at the existing examples in the boilerplate code. You will need create a mapping in your Application module.

Configuration.Modules.AbpAutoMapper().Configurators.Add(mapper =>
            {
                //Add your custom AutoMapper mappings here...
                //mapper.CreateMap<,>()
                mapper.CreateMap<CustomerDto, Customer>();
            });

I was able to figure this out. (was too tired last night I guess)

I had to check for both impersonator Id's in ng2.

this.isImpersonatedLogin = abp.session.impersonatorTenantId != null || abp.session.impersonatorUserId != null;

There is still a problem in the AuthToken controller with the fore mentioned still not being set in the AbpSession. I'm unable to check for cascading logins by using AbpSession. Looks like I will have to check the cache item or pass them in. The AbpSession worked in MVC. I suspect because the browser was actually visiting the endpoint with the tokenId as a get param and then redirecting.

Hi there, I've been trying to implement impersonation with the ng2 / core application. I've managed to port the mvc code mostly to the token auth based AuthToken controller. I have it working for the most part, but when impersonating from Host the ImpersonatorUserId is not populated in the front end. When impersonating from Default tenant, it is populated.

OWIN HttpContext.GetOwinContext().Authentication is no longer supported in Core. So I've had to drop the SignIn and SignOut methods (I am using the _authService.logout(false) and waiting for token, then using login service). I am wondering if this is the problem I am facing? Basically AbpSession is not working as expected on the backend. I realize AbpSession is cookie based, but tenantId is always populated so I am a bit confused. UserId and ImpersonatorUserId are never available in abpSession(backend) so I have to pass them in through the nswag service-proxies.

The bad behavior I am experiencing is that "<-- Back to my Account" is never available on front end from host when checking for ImpersonatorUserId . Works for Default tenant.

It's a bit difficult to articulate my problem. Hope you understand what I am asking.

Any suggestions?

The Migration-Tool will populate the database tables without removing the prefix. Seed data fails. Will not build with OnModelCreating method in place. Throws an exception.

I have another unrelated question. What happened to the dynamic JS service proxies? Will they not work with core?

thanks

First off, I would like to commend you on a job well done putting together the .NET Core / Angular2 project. You guys did an amazing job of keeping the architecture as close as possible to it's predecessor. The separation of concerns, the .html template files, TypeScript etc. The code is clean as expected!

I'm in the process of migrating my MVC project over to Core and it's going fantastic. Copying and pasting entire classes that just work! I did however come across one hiccup. The OnModelCreating method modelBuilder.ChangeAbpTablePrefix<Tenant, Role, User>(""); is not working. No big deal, moving on.

Is there any chance you can create a new forum that is .NET Core / Angular2 specific? I think it would help development moving forward. Breaking out the two would help tremendously and alleviate any confusion between the two architectures.

Thanks again for this amazing software and contribution to the community!

Not sure what I'm missing here, but I can't seem to find the navigation property for the User Email Address for a tenant. Also need to be able to update it. The TenantForEditInput only contains the tenant id.

Thanks

public async Task<TenantForEditDto> GetTenantForEdit(TenantForEditInput input)
        {
            var tenant = await _tenantManager.GetByIdAsync(input.id);

            TenantForEditDto tenantDto = new TenantForEditDto() { Tenant = tenant.MapTo<TenantDto>() };

            tenantDto.Tenant.AdminEmailAddress = //?? help

            return tenantDto;
        }

Hi Alistar, I would like to give my two cents on Angular2 and aspnetboilerplate. I hope this helps someone who is on the fence about converting from AngularJS that boilerplate comes with. Again this is just my humble opinion.

I started to convert the software over to angular 2 and ran into waaay too many problems. Angular 2 itself is a half baked mess with breaking changes and beta modules from vendors. The compiled components are huge in file size which forces you to lazy load components if the app is going to have any size to it (large solution). This sounded great until I found out WebPack doesn't support Lazy Loading yet. Breaks the build. That was the final straw for me as I kept hitting walls like this over the 10 days I spent on it. 10 days of wrapping my head around Angular2, fixing all the typescript dependencies in Visual Studio, getting my build scripts just right, building components and so on.

Personally I think I will wait until angular 2 gets all the kinks worked out and even then I don't consider it a good fit for ASP.Net MVC or Core unless you are using the fore mentioned as a middle tier and DAL only. It just doesn't make sense. Razor views are no longer useable and it defeats the purpose of MVC in ASP.Net altogether. I did see a post where you could run the template of a component through the controller to use Razor Views, but I couldn't get it to work. WebPack didn't like that either. At this point I wasn't about to convert over to Gulp and have to start all over.

I think Angular 1 is a good fit and makes sense for ASP MVC. as of this writing.

I am certain moving forward the kinks will get worked out and clever developers will come up with usable patterns for MVC and Core, but as of right now, I have chosen to stay with AngularJs

Paul

Showing 1 to 10 of 10 entries