Base solution for your next web application

Activities of "rickwheeler"

Since lazy loading is not yet added to EF Core, how do I eager load related entities for all get methods?

For example:

public class MyEntity : Entity
{
    public int MyRelatedEntityId { get; set; }
    public MyRelatedEntity Related { get; set; }
}

How do I make sure that all methods on IRepository<MyEntity> eager load and include MyRelatedEntity? This includes GetAll, GetById, Find etc

Hi,

What are you suggestions for upgrading from v3.4.0 to v4.0.0?

I seem to have been able to update all of my source code just fine. The issue I have is with the database.

Since you've swapped from EF6 to EFCore, this has caused a major problem as there is a missing migration.

It appears that between 3.4.0 and 4.0.0 of AspNetZero that there were a lot of database changes. Since the EntityFrameworkCore project assumes there is no existing database and only includes an Initial migration I have no real way to upgrade my database which is on v3.4.0.

The changes seem to include the removal of some tables, column additions to some entities such as user, changes to indexes and more.

Do you have any suggestions for how to accomplish upgrading the database?

Thanks.

Question

Hi,

Just wondering if it is safe to disable Entity Framework Lazy Loading?

public MyDbContext()  : base("Default")
{
    this.Configuration.LazyLoadingEnabled = false;
}

I want to disable it in my DbContext but want to make sure it isn't going to cause any issues with ABP.

Thanks, Sean

Hi,

If I define a route like the following underneath all routes in in the RouteConfig.cs, calls from the angular app to the dynamic API no longer work. Instead, they are passed to my CatchAllController as shown in the image.

routes.MapRoute(
                "CatchAll",
                "{*urlString}",
                new { controller = "CatchAllController", action = "Index" }
            );

This is a fairly major issue for us at the moment so any help on how to resolve the problem would be appreciated.

Perhaps it has to do with moving the order of precedence for dynamic api routes above my catch all route? The catch all route should be the very last option if no other routes were found.

Regards, Sean

Hi,

In Abp.Configuration.Setting.Value the string length is set to 2000.

I need the field to be NVARCHAR(MAX)

How would you suggest to accomplish this in an ABPZero template?

Regards, Sean

Hi,

I'm trying to write some code to create a new tenant from a console application.

  • Download ASP.NET Zero template
  • Add a new console application to the solution
  • Make it a module just like the Migrator tool using the same code for bootstrapper etc
  • Call TenantManager.CreateWithAdminUserAsync

When I do this, I receive the error "There is no permission with name: Pages.Tenants"

I have both data and core modules added as dependencies to my console application module. Are you able to replicate this problem?

Any help appreciated.

Cheers, Sean

Hi,

I haven't been able to figure out how to fix this yet. I tried to find a solution for you but couldn't so perhaps you can help.

The "active" state on the administration menu seems a little buggy. Here are the steps to replicate with a fresh install of ABP Zero.

I'm using the SPA/Angular version of Zero.

  • Log in as admin, the tenants screen is shown. Notice on the left there is a solid blue border showing.

  • Click "Administration", the admin menu drops down.

  • Click "Organization Units". Notice how the administration is now collapsed (It shouldn't be collapsed), there are no menu items highlighed and nothing with a solid blue border on the left.

  • Click "Administration" again

  • Click "Roles". Notice that Administration menu is now highlighed with a solid blue border on the left.

  • Click "Users". The menu continues to stay as highlighted.

  • Click "Tenants". Notice how there are now TWO menu items highlighted!

  • Click "Editions". The admin menu collapses and only one menu item is highlighed now.

  • An item under the admin menu needs to be clicked twice in order for it to be highlighted

  • The admin menu should not collapse after clicking the first item

  • The admin menu should not stay highlighted after click back to tenants/editions

The issue appears to have something to do with angular ui router and $state as well as the ui-sref-active directive. I'd say it has something to do with the nested nature of the menu but unfortunately I haven't been able to figure out what is causing this.

Can you please investigate this problem?

The seed method is creating duplicate records in AbpFeatures table. The issue is even worse if update-database has been run more than once

Issue:

Id	Name	Value	CreationTime	CreatorUserId	EditionId	TenantId	Discriminator
1	App.ChatFeature	True	2016-09-05 15:27:34.967	NULL	1	NULL	EditionFeatureSetting
2	App.ChatFeature	True	2016-09-05 15:27:34.967	NULL	1	NULL	EditionFeatureSetting
3	App.ChatFeature	True	2016-09-05 15:27:34.970	NULL	1	NULL	EditionFeatureSetting
4	App.ChatFeature	True	2016-09-05 15:27:34.970	NULL	1	NULL	EditionFeatureSetting
5	App.ChatFeature	True	2016-09-05 15:35:37.130	NULL	1	NULL	EditionFeatureSetting
6	App.ChatFeature	True	2016-09-05 15:35:37.130	NULL	1	NULL	EditionFeatureSetting
7	App.ChatFeature	True	2016-09-05 15:35:46.173	NULL	1	NULL	EditionFeatureSetting
8	App.ChatFeature	True	2016-09-05 15:35:46.173	NULL	1	NULL	EditionFeatureSetting

Fix: In ABPZero.EntityFramework/Migrations/Seed/Host/DefaultEditionCreator.cs

Replace

_context.EditionFeatureSettings.Add(new EditionFeatureSetting
     {
         Name = AppFeatures.ChatFeature,

With

_context.EditionFeatureSettings.Add(new EditionFeatureSetting
     {
         Name = featureName,

I noticed that in all the grids of the interface, the date format and time was displaying incorrectly.

Problem 1: Date format was incorrect Since I'm in australia, our date format is dd/MM/yyyy.

In all of the ABP Zero grids, the date was showing as MM/dd/yyyy which is wrong.

The grid options displayed as follows

{
    name: app.localize('AnImportantDate'),
    field: 'anImportantDate',
    cellFilter: 'momentFormat: \'L LT\'' // Moment.js Local string format. Formats to local locale settings
}

This should mean that the items in the grid would display in the locale set in moment js.

Problem 2: Time was incorrect. Since my time zone is UTC+10, I saved an item at 9am 05/05/2016 and it was displaying in the grid as 04/05/2016 (One day earlier). This is because the UTC time passed by AppService is not being converted to local time in the GUI.

To Fix: XYZ.Web/App/Common/Filters/momentjs-filters.js

// need load the moment.js to use these filters. 

(function () {

    appModule.filter('momentFormat', function () {
        return function (date, formatStr) {
            if (!date) {
                return '-';
            }
            
             moment.locale(window.navigator.userLanguage || window.navigator.language); // Fixes problem 1
             return moment(date).local().format(formatStr); // Fixes problem 2
        };
    })
    .filter('fromNow', function () {
        return function (date) {
            return moment(date).fromNow();
        };
    });

})();
Question

Hi,

What is required for an AbpSession to be populated on a controller?

I am creating a custom REST API that uses an API Key to authenticate users and I want my API controller to inherit from AbpApiController. So I need to know what to set in the pipeline in order for AbpSession to be populated on the ApiController. Does it use Thread.CurrentPrincipal?

Regards, Sean

Showing 1 to 10 of 12 entries