Base solution for your next web application

Activities of "mhrabak"

Hi guys, we are facing an issue when we register ngrx effect with injected service (generateg using nswag). when we register effect into root module angular throws exception because abp config is not yet loaded properly because app_initializer is not probably yet finished or effect is registered earlier we can not find a way how to obtain this issue unfortunately. We are quite new in angular.

Do you have any advices pleaee thanks.

we are using latest aspnetzero web api & angular 8 template.

thanks a lot.

Hi guys, We are trying to configure our app to run as Windows service but we are unable to run aspnetzero as WindopwsService. The error we get when try to run app is this:

ConfigureServices returning an System.IServiceProvider isn't supported.

I found out that this problem occurs because of CastleWindsor which does not support .NET Core 3 approach. Some possible unofficial approach found here: https://github.com/castleproject/Windsor/issues/493 Do you plan to try it out or do you have any advice how to run app as WindowsService in .net core 3? We tried this approach (it is just simplified version to show you the direction nto the path):

public static void Main(string[] args) {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .UseWindowsService()             
                .ConfigureWebHostDefaults(webBuilder => {
                    webBuilder.UseStartup<Startup>();
                });
    }

Thanks a lot.

Tested version: Latest Tested app: Demo Project type: ASP.NET Core & Angular

Hi guys, We are facing an issue in abp/zero. We consider build as failure when all tests does not pass so we had to skip only one test of yours for now. use case:

  1. Download any demo or live project - we are using ASP.NET Core & Angular
  2. Disable SoftDelete filter - I added Configuration.UnitOfWork.OverrideFilter(AbpDataFilters.SoftDelete, false); line to <ProjectName>ApplicationModule.Preinitialize method
  3. Run Localization.LanguageAppService_Tests.Delete_Language test in <ProjectName>.Tests.csproj

Assertion error occurs: Shouldly.ShouldAssertException : currentLanguages.Any(l => l.Name == randomLanguage.Name) should be False but was True I guess problem is that instance of deleted ApplicationLanguage is not removed from cache. I had to admit I don't have time to research why now but I guess IEventHandler<in TEventData>.HandleEvent is not called.

Thanks.

Hi guys, I just want to make it clear for me. I read this: https://support.aspnetzero.com/QA/Questions/2248 If I understand it well UserAccount is used only when Multitenancy is enabled? Otherwise this table can be empty? I am asking because we have to connect Zero to the existing DB which does not have UserAccount table and it is not desired to have one. For now we don't want to use multitenancy so if I am right this should not be a problem.

Second question: We have existing DB and try to run Zero against it so we must initialize all necessary tables for Zero/Abp correctly - which we are unable for now. If we disable Multitenancy we have to store Default Tenant to DB? I am asking because we are facing an issue because your default Seeder always creates Host and Tenant user and Default tenant is added to DB too. During logon (to swagger) is generated SQL query like this: exec sp_executesql N'SELECT TOP(1) [user].[Id], [user].[AccessFailedCount], [user].[AuthenticationSource], [user].[ConcurrencyStamp], [user].[Created], [user].[CreatorUserId], [user].[DeleterUserId], [user].[DeletionTime], [user].[EmailAddress], [user].[EmailConfirmationCode], [user].[GoogleAuthenticatorKey], [user].[IsActive], [user].[IsDeleted], [user].[IsEmailConfirmed], [user].[IsLockoutEnabled], [user].[IsPhoneNumberConfirmed], [user].[IsTwoFactorEnabled], [user].[LastModificationTime], [user].[LastModifierUserId], [user].[LockoutEndDateUtc], [user].[Name], [user].[NormalizedEmailAddress], [user].[NormalizedUserName], [user].[StoredPassword], [user].[PasswordResetCode], [user].[Person], [user].[PhoneNumber], [user].[ProfilePictureId], [user].[SecurityStamp], [user].[ChangePasswordOnFirstLogon], [user].[SignInToken], [user].[SignInTokenExpireTimeUtc], [user].[Surname], [user].[TenantId], [user].[UserName] FROM [User] AS [user] WHERE (((@__ef_filter__IsSoftDeleteFilterEnabled_0 = 0) OR ([user].[IsDeleted] = 0)) AND ((@__ef_filter__IsMayHaveTenantFilterEnabled_1 = 0) OR ([user].[TenantId] = @__ef_filter__CurrentTenantId_2))) AND (([user].[NormalizedUserName] = @__normalizedUserNameOrEmailAddress_0) OR ([user].[NormalizedEmailAddress] = @__normalizedUserNameOrEmailAddress_0))',N'@__ef_filter__IsSoftDeleteFilterEnabled_0 bit,@__ef_filter__IsMayHaveTenantFilterEnabled_1 bit,@__ef_filter__CurrentTenantId_2 int,@__normalizedUserNameOrEmailAddress_0 nvarchar(256)',@__ef_filter__IsSoftDeleteFilterEnabled_0=1,@__ef_filter__IsMayHaveTenantFilterEnabled_1=1,@__ef_filter__CurrentTenantId_2=1,@__normalizedUserNameOrEmailAddress_0=N'ATTN'

The problem part is in WHERE clause: ((@__ef_filter__IsMayHaveTenantFilterEnabled_1 = 0) OR ([user].[TenantId] = @__ef_filter__CurrentTenantId_2)) where @__ef_filter__CurrentTenantId_2 = 1 expected is null Same happens when we have our table with Navigation property of type User and try to Include - same where clause is added so nothing is returned from database.

I guess it is about to configure application somehow but I can not find in your documentation how to make it work without multitenancy for now. In future we want to enable multitenancy so maybe we try switch the MultitenancyEnabled to true now and will see what happens.

But still it would be nice to have all the informations on how to make application run both ways: Host and Multitenancy without problems.

Hi guys, We try to implement our own Repository (https://aspnetboilerplate.com/Pages/Documents/EntityFramework-Integration) but we are facing an issue. When I use piece of code above (TaskAppService) exception is raised, but when we change generic to TaskEntity type (EfCore entity) everything works fine. Unfortunately we need to use TaskDto instead of TaskEntity. TaskDto inherits from IEntity<TPrimaryKey> Exception is raised when we try to execute action GetTasks. WebAPI starts as usual without any problem. AutorepositoryTypes registration:

 [AutoRepositoryTypes(
        typeof(ICustomRepository<>)
        , typeof(ICustomRepository<,>)
        , typeof(AttisDemoRepository<>)
        , typeof(AttisDemoRepository<,>)
        , WithDefaultRepositoryInterfaces = true
        )]

Raised exception:

'AttisDemo.Tasks.TaskAppService' is waiting for the following dependencies:
- Service 'AttisDemo.ICustomRepository`1[[AttisDemo.Tasks.Dto.TaskDto, AttisDemo.Application.Shared, Version=7.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

TaskAppService:

 public class TaskAppService : AttisDemoAppServiceBase, ITaskAppService {
        [NotNull]
        private readonly ICustomRepository&lt;TaskDto&gt; _taskRepo;

        public TaskAppService([NotNull] ICustomRepository&lt;TaskDto&gt; taskRepo) {
            _taskRepo = taskRepo;
        }

        public async Task&lt;ListResultDto&lt;TaskDto&gt;> GetTasks() {
            var tasks = await _taskRepo.GetAll().ToListAsync();
            return new ListResultDto&lt;TaskDto&gt;(tasks);
        }

        public async Task&lt;TaskDto&gt; GetTaskById(TaskInput filter) {
            var task = await _taskRepo.GetAll().WhereIf(filter?.Id != null, tasks => tasks.Id == filter.Id)?.FirstOrDefaultAsync();
            return task;
        }

        public async Task CreateTask(TaskDto input) {
            //var taskEntity = ObjectMapper.Map&lt;TaskEntity&gt;(input);
            await _taskRepo.InsertAsync(input);
        }

        public async Task UpdateTask(int taskId, TaskDto input) {
            var taskEntity = await _taskRepo.GetAsync(taskId);
            taskEntity.Description = input.Description;
            taskEntity.Identification = input.Identification;
            await _taskRepo.UpdateAsync(taskEntity);
        }
    }

TaskRepo:

 public class TaskRepo : AttisDemoRepository&lt;TaskDto&gt; {
        public TaskRepo(IDbContextProvider&lt;AttisDemoDbContext&gt; dbContextProvider) : base(dbContextProvider) {
        }

        public override IQueryable&lt;TaskDto&gt; GetAsQuearyable(Expression&lt;Func&lt;TaskDto, bool&gt;> criteria) {
            var taskDtos = Context.Tasks.Select(a => new TaskDto {
                Id = a.Id,
                Description = a.Description,
                Identification = a.Identification
            });
            if (criteria != null) {
                return taskDtos.Where(criteria);
            }
            return taskDtos;
        }

        public override Task&lt;TaskDto&gt; GetByKeyAsync(int id) {
            return GetAll().FirstOrDefaultAsync(a => a.Id == id);
        }
    }

Thanks in advance.

Hi guys, I tried to implement OData support for ASPNet Zero template but I am facing problem. I guess we can not use ApplicationService when we want to use OData right? I followed this article but the problem is we want to use Dtos/ViewModels instead of Entities, but AbpODataEntityController force us to use (and return) Entities. Idea is that repos will work with Entities and controller will transform entities to ViewModels and return ViewModel. So something like this: ` [AbpMvcAuthorize] public class ODataController<TEntity, TViewModel> : AbpODataController where TEntity : class, IEntity where TViewModel : class, new() {

[NotNull] private readonly IRepository _repository;

[NotNull] private readonly IMapper _mapper;

public ODataController([NotNull] IRepository

For ODataConventionModelBuilder we will register Dtos/ViewModels instead of Entities too. In our one of our applications we have something similar. We must specify TEntity too just for sake of Repository. Question is when we implement this will we be able to use nswag for generating proxies in angular? What about permissions in angular? Do you see some problems with this solution? Do we have to rework generated AppServices to controllers to be able to use them with OData too?

Thanks in advance.

Showing 1 to 6 of 6 entries