Activities of "christophe.baille"

  • ABP Framework version: v4.4.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

I previously made a feature to add all roles and permission when creating a new tenant which works perfectly. For that I created a class which inherit from IDataSeedContributor on Application project:

On SeedAsync method, I call this CreateRolesAndPermission which create roles, then for each role, I create permission

I get my roles from this class which in in Domain.Shared

To get the list of permission per role, I created an IEnumerable<string> that I create and fill directly on AppPermission class which is on Application.Contract project.

The feature which is not going well for me, is to update permissions when run DbMigrator.

Note/reminder about IDataSeedContributor (from some tests that I did): When creating a new tenant, it will run all classes which inherit from IDataSeedContributor from Application AND Domain projects. When run DbMigrator, it will run all classes which inherit from IDataSeedContributor from Domain projects only.

So, if I want to run something while running DbMigrator, I need to create a class which inherit from IDataSeedContributor on Domain project.

To update roles and pemission, I do something similar than for tenant creation, I get the list of roles from my class AppRoleConsts and check if exists or not on each tenant. To check all permission for each role, I then need to reach the list of permission, which is my issue : as I am now in Domain project, I do not have access to Application.Contract, and to keep a clean architecture, I should not add a reference. What I then tried, was to move my AppPermissions class from Application.Contract to Domain.Shared project. If most of it sounds ok, I got the issue when I want to add permissions from other AbPModule (here it is Blogging) to my IEnumerable<string>

The only way to make it work, it is to add the reference of Blogging.Application.Contracts.Shared to my domain project, which will make the architecture not clean again...

Is there any other way to make DbMigrator updating permission for each tenants without Domain project referencing Application.Contracts? It works on my project for now, but the architecture is a bit wrong now...

Would it not be possible to move all this permission from contract/contract.shared to domain.shared for example? It is just a suggestion/idea, I don't really know if this is wrong or not for your actual architecture actually...

Thanks

Thanks for your answer, but it is not exactly what I want to do. I want to show in a specific TimeZone for all users, plus of that, I should be able to edit the value, so sending to a datetime picker will not work.

In my example here, I want to show the value from Paris local zone (UTC+2), but I am based is SE Asia (UTC+7)

I am usingClock Kind as Utc, database value is: 2021-06-08 09:00:00.0000000

My back-end datetime value get the same value with Utc kind.

// 1- I define my timezone var zone = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); // 2- I convert my time from Utc to Paris local time tmpStartReporttime = TimeZoneInfo.ConvertTimeFromUtc(tmpStartReporttime.Value, zone); So I get the time increased from 2 hours (UTC+1 + DST = 2) which is 11:00

// 3- I change kind to local as the previous method change it to unspecified. tmpStartReporttime = DateTime.SpecifyKind(tmpStartReporttime.Value, DateTimeKind.Local); I get now still 11:00 but local instead of Unspecified

It is then sent to my Angular front-end. I sent local value, so here, it seems it convert the raw from the local value sent, using the local Timezone which is SEA (UTC -7). So now the value done through datepipeline is ok, but the "raw" is 7 hours earlier.

The issue here, is that the value returned by Angular to my back-end is UTC, so it is -7 value from my UI, it convert from my actual local timezone... For example, here I did put 11:10, but the utc is 04:10

If on the step 3 I do not change Utc to local, the value will be changed by date pipeline so added 7 hours more

About using NgbDatePicker, I did try but this component do not let the user choose date AND time on his UI

The issue have been fixed a month ago with liangshiwei.

As he mentionned:

Delete the DbContextModelCreatingExtensions will work.

I just forgot to comfirm... Sorry for th convenience

I find out on how to convert on a specific timezone for a label. I need to add the UTC I want like this (on here I get Clock Utc option, so the string is Z:

{{ '2021-09-17T03:00:08Z' | date: 'short' :'UTC +2' }}

The problem here, is that I do this on the HTML, from my angular I get this, is there any way to make change on each element of this Abp list:

Plus, if I find a way to show it with the TimeZone I want, how can I convert on the way back when it passed through the formControlName property? Does ABP has anything to convert it or I had to find out on how Angular do it?

I had a closer look, in my previous message I was a bit wrong:

When I select option Utc, in back-end I got a date and type of kind Utc

and the "raw" value in front-end is 2021-09-15T14:29:09.767Z

When I select option Local, in back-end I got a date and type of kind Unspecified, is it normal? It should not be local instead?

and the "raw" value in front-end is 2021-09-15T14:29:09.767**+07:00**

It then use DatePipe to convert in local or not?

https://angular.io/api/common/DatePipe

  • ABP Framework version: v4.4.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

I want to convert some DateTime UTC of a report entity, not to my "local" timezone but to another which the name will be saved on this same report entity.

I had a look around and it seems do not really understand on how it works.

I checked this doc https://docs.abp.io/en/abp/latest/Timing#clock-options and made some tests. At the moment we use options.Kind = DateTimeKind.Utc, so the DateTime on the database are in UTC, when I show them on my view, it is changed regarding my local DateTime which is fine. I did the test to replace Utc by local, and as expected, I got the same value from the datbase in my UI.

To try to understand more, I put a breakpoint on my code, and I did notice that either Utc or Local, the value coming from the database remain the same, the one from the database, it means the "transformation" have not been done yet. It makes sense actually, as the conversion should be done in front-end to have local timezone if I am right.

I then made a test on my UI, to show my date in 2 "different" ways, one showing the "raw" value, another formatted:

And I got this result:

So we can see that the "raw" value is kept as same as on the database, but when I "format" on date, it will convert to the local timezone.

My question here, is how {{ row.endDateTime | date: 'HH:mm' }} convert to my local time or not depending on the AbpClockOptions kind values? I can not find anything on Angular.

I am looking at ABP doc, but appart the link I shared before, I do not find much. Then from here, I will have a way to convert to the TimeZone I want or it is in some ABP angular packages?

Thanks

Tested with version 4.4.2, both issues are resolved

It still doesn't work:

I login in english, then go to MVC blogging view --> I reach blogging view in english: OK, it works now, it was not before

I login in Finnish, then go to MVC blogging view --> I reach blogging view in Finnish: OK, it works now, it was not before

I login in english, I then change language to finnish after login from my Angular UI, then go to MVC blogging view --> I reach blogging view in english: KO, shoud be in Finnish

I login in Finnish, I then change language to english after login from Angular UI, then go to MVC blogging view --> I reach blogging view in english: KO, shoud be in english

Don't know if this has anything to do but in my case, when I switch the language to French and click on Logout, it does not automatically redirect to login screen. Also the text in the button is empty.

It's a different problem that will be fixed very soon apparently:

https://support.abp.io/QA/Questions/1718/Bugs-when-switch-between-Angular-and-Account-MVC-view

You can fix it already by editing the translation text of the language you are using in languge management, just need to remove {0} from ReturnToText target value, replace by "l'application" in that case.

I tried with a new solution and do not have this issue to generate a new entity it works well. For my existing solution, could this DbContext name asked be stored somewhere on the database?

I don't understand on why it is still looking for this MigrationDbContext, I didn't declare it anymore on my solution

Showing 101 to 110 of 188 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30