Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "cyklussoftware"

I got it working. I guess I overlooked the AppConfigurations.Get() method in the MigratorModule the first time I tried this. Now I just pass the name of my environment to that method and it works great.

Thanks!

Answer

I know about the GET request header called "Abp.TenantId", but because I want to return an ICS file using the URL ONLY and NOT through a GET request, I am having trouble.

I could create an [AllowAnonymous] MVC Controller method that takes in the tenantId as a parameter. The method can create and execute a new GET request with the Abp.TenantId header set. This will give me access to the AppService and its repositories. Once the [AllowAnonymous] MVC Controller method has the JSON data from the AppService's response, I can parse it and return the file.

Is there a better way to do this?

Answer

Right. I see AllowAnonymous for MVC controllers and AbpAllowAnonymous for AppService methods, but how do I access a specific repository without having a logged in user? Is there any build-in system for this? Or will it need to be a custom system like: access host DB, look for tenant DB based on URL parameter, then access tenant DB?

Alright, sorry for the large number of posts, but I got it to work. Turns out the checkbox was returning the value of "on/off" instead of "true/false" which threw everything off.

In my _CreateModal I added the 'value' attribute to the checkbox and set 'value="true"'. Setting the value to true doesn't set the checkbox to checked/unchecked, but I guess it triggers it to return true/false instead of on/off.

Then in my _EditModal, I added an @Html.EditorFor(x => x.IsOrganizer). Now the checkbox is properly checked and unchecked and returns the proper true/false value.

Turns out this is only a problem if the CheckBox is checked. If it is unchecked, the form saves correctly.

Great! Thanks for the detailed answer.

I am getting an error when trying to create a new OrganizationUnit with the _CreateModal.cshtml (with my added check-box)

The error says "Your request is not valid! The following errors were detected during validation. -"

Is there some javascript file that I need to change?

Will this feature be released at the same time as the Foreign Key / Existing Entity feature?

Foreign Key / Existing Enity Forum Post: #4736

I use "npm uninstall datamaps" from my MVC directory before attempting to delete a project.

Thanks for the suggestion. I think I will be able to figure my way through this eventually. I'll re-create my solution when foreign key support is added. In the mean time, it's good for me to learn about the way ASP.NET Zero works.

I am currently struggling with DTO circular references. I have the following entities:

[Table("Location")]
    public class Location : Entity , IMustHaveTenant
    {
        public int TenantId { get; set; }

        [Required]
        public virtual string Name { get; set; }

        public virtual int Radius { get; set; }

        public virtual LocationCategory.LocationCategory Category { get; set; }
    }
[Table("LocationCategory")]
    public class LocationCategory : Entity , IMustHaveTenant
    {
        public int TenantId { get; set; }

        [Required]
        public virtual string Name { get; set; }

        public ICollection<Location.Location> Locations { get; set; }
    }

and the corresponding DTOs:

public class LocationDto : EntityDto
    {
        public string Name { get; set; }

        public int Radius { get; set; }

        public LocationCategory.Dtos.LocationCategoryDto Category { get; set; }
    }
public class LocationCategoryDto : EntityDto
    {
        public string Name { get; set; }

        public Collection<Location.Dtos.LocationDto> Locations { get; set; }
    }

I have set up my LocationAppService and LocationCategoryAppService using the ".Include" method so that the navigation properties for the Entities are filled.

When I test the "getAll" method using the Google Chrome console, I get a 500 Internal Server Error. Eventually, I figured out that if I comment out either "public LocationCategory.Dtos.LocationCategoryDto Category { get; set; }" OR "public Collection<Location.Dtos.LocationDto> Locations { get; set; }" I am able to view the data in the database. So I clearly have a circular reference error.

My questions are these:

  1. Is it possible to change the JSON serializer settings or is it still embedded in ABP stuff?

  2. Without changing the JSON serializer settings, is there a way to resolve the circular reference issues?

Note: Both Locations and LocationCategories will have their own dedicated UI pages (as generated by the RAD Tool). I will want to look up (through navigation properties) which Locations belong to a LocationCategory and vice-versa from each UI set.

Not sure why, but I cannot log in to the Default tenant. I can log into the Host just fine, but not Default. I get the error "A problem occurred while trying to communicate with the server. Do you want to try again?"

Running on Android emulator. Host running using .BAT file.

Showing 11 to 20 of 23 entries