Base solution for your next web application

Activities of "DennisAhlin"

The integration entity gets soft deleted, but not the steps (they are untouched). Aren't cascading of soft deletion implemented in Boilerplate?

Hi! I have an integration entity, which have many integration step entities. The steps also have links to other steps in the same integration.

Like

Integration1 || \ Step1 = Step2

I can not figure out how to get the cascade deletion working when I delete an integration? The integration is deleted, but not the integration steps. How can I solve this?

Thank you!

I solved it with method 2. I tried with NSwag first, but since it does not generate a base client I was required to make a partial class with the interception for every controller, which is a bit tedious and takes away a part of the benefits of code generation. Therefore I went for Swagger Codegen instead, where I only need to make a partial of the base ApiClient for the interception. It was also easier to solve the authorization part in Codegen.

Hi! TL;DR: .NET Clients generated from swagger.json cannot parse models from API because they think that response.Content will contain the Model, but the model is wrapped in a response class, which makes the deserialization fail. How to solve this?

I am making a .NET client for accessing my application's API externally, so I've generated a client with Swagger Codegen (<a class="postlink" href="https://github.com/swagger-api/swagger-codegen">https://github.com/swagger-api/swagger-codegen</a>). But when the client is trying to parse a response, it fails because it thinks that the request.Content is going to be the same as the model defined in the swagger.json, but it isn't. The model is wrapped in a response body, which makes the deserialization fail.

I.e. for TokenAuth/Authenticate client expects response.Content be like { "accessToken": "wtqt2...warar", "encrypted..": ...}, but instead it is {"result": { "accessToken": "wtqt2...warar", "encrypted..": ...}, "targetUrl": "..", ....}.

I'm not sure where the fault lies here, is there something wrong in the swagger.json, Swagger Codegen or is there some kind of configuration in Codegen I'm missing?

PS. I did a quick try in NSwag and the problem seems to be there as well. Weird thing is that it obviously works for DS.

Regards

Hi!

My classes:

public class Member: FullAuditedEntity, IMustHaveTenant
    {
        [Required]
        public int TenantId { get; set; }

        [ForeignKey("CompanyId")]
        public virtual Company Company { get; set; }
        public virtual int? CompanyId { get; set; }
    }
public class Company : FullAuditedEntity
    {
        [Required]
        public string Title { get; set; }
        public virtual ICollection<Member> Members { get; set; }
    }

I want the list of all members after adding a member to a company, like this:

...
newMember.CompanyId = 12;
await _repository.InsertAsync(newMember);
await CurrentUnitOfWork.SaveChangesAsync();
var membersOfCompany = newMember.Company?.Members;
...

But the newMember.Company is null after the save changes? How can I load the cooperation entity to the new member?

Just FYI, here you can read more about the implementation of UOW :)

<a class="postlink" href="https://www.aspnetboilerplate.com/Pages/Documents/Unit-Of-Work">https://www.aspnetboilerplate.com/Pages ... it-Of-Work</a>

Hi! I need to store some login credentials (username/password) to external services (like FTP accounts) that my users can enter. Therefore I need to store these in the database, but of course not in plain text, so I need to encrypt it in some way so that I can decrypt them later and use them to access the FTP account from my server. Is there a utility for this in ABP or Zero? I figured user passwords are hashed by Identity.IPasswordHasher, but as far as I can tell, those passwords are not retrievable (as they should), so that's not an option.

Regards.

GitHub issue here: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/109">https://github.com/aspnetzero/aspnet-ze ... issues/109</a>

I solved it like this:

private static loadLocalizedScripts(): JQueryPromise<any> {
        if (!abp.session.userId) {
            return $.Deferred().resolve();
        }

        var currentCulture = abp.localization.currentLanguage.name;

        var jTable = "/assets/localization/jtable/jquery.jtable.{0}.js";
        var bootstrapSelect = "/assets/localization/bootstrap-select/defaults-{0}.js";
        var jqueryTimeago = "/assets/localization/jquery-timeago/jquery.timeago.{0}.js";

        return $.when(
            ((currentCulture !== 'en') ? jQuery.getScript(abp.utils.formatString(jTable, LocalizedResourcesHelper.mapCultureForJtable(currentCulture))) : $.Deferred().resolve()),
            jQuery.getScript(abp.utils.formatString(bootstrapSelect, LocalizedResourcesHelper.mapCultureForBootstrapSelect(currentCulture))),
            jQuery.getScript(abp.utils.formatString(jqueryTimeago, LocalizedResourcesHelper.mapCultureForTimeago(currentCulture)))
        );
    }

    private static mapCultureForJtable(currentCulture: string): string {
        const cultureMap = {
            'sv-SE': 'se',
            'sv': 'se'
            //Add more here
        };

        if (cultureMap[currentCulture])
            return cultureMap[currentCulture];

        return currentCulture;
    }

    private static mapCultureForBootstrapSelect(currentCulture: string): string {
        const cultureMap = {
            'en': 'en_US'
            //Add more here
        };

        if (cultureMap[currentCulture])
            return cultureMap[currentCulture];

        return currentCulture.replace('-', '_');
    }

    private static mapCultureForTimeago(currentCulture: string): string {
        const cultureMap = {
            'sv-SE': 'sv'
            //Add more here
        };

        if (cultureMap[currentCulture])
            return cultureMap[currentCulture];

        return currentCulture;
    }

When Swedish language is selected (sv-SE or sv), LocalizedResourcesHelper tries to find jquery.jtable.sv-SE.js or jquery.jtable.sv.js here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/3c65f620aab8042b9b85109054c606836d15b8ed/angular/src/shared/helpers/LocalizedResourcesHelper.ts#L40">https://github.com/aspnetzero/aspnet-ze ... per.ts#L40</a> Too bad the language file is called jquery.jtable.se.js, so we get a 404. The same goes for jquery timeago.

Bootstrap Select also checks for supported cultures, so it reverts to english, since it cannot find sv-SE or sv in the supportedCultures array.

This is probably not only a problem with Swedish. How to solve this best?

Showing 11 to 20 of 34 entries