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

Filters problem #400


User avatar
0
gvb created

I try to seed Data in my Tenant, User, Role from the InitialDataBuilder and i get this error

Can not set TenantId to a different value than the current filter parameter value or IAbpSession.TenantId while MayHaveTenant filter is enabled!

It should not be active because i did all as usual....

In Core Module Configuration.MultiTenancy.IsEnabled = false;

in Seed context.DisableAllFilters(); new InitialDataBuilder(context).Build();

I dont know how to fix it when i already did the normal thing to remove the filters. Can someone help me plz.

i dont want to need to hack the framework to put a Session in Seeder...


2 Answer(s)
  • User Avatar
    0
    gvb created

    ok here is a part of my log that show something that is bad

    DEBUG 2015-10-08 12:37:06,723 [1 ] Abp.Modules.AbpModuleManager - Loading Abp modules... DEBUG 2015-10-08 12:37:08,505 [1 ] Abp.Modules.AbpModuleManager - Found 13 ABP modules in total. DEBUG 2015-10-08 12:37:08,509 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AutoMapper.AbpAutoMapperModule, Abp.AutoMapper, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,511 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AbpKernelModule, Abp, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,511 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.EntityFramework.AbpEntityFrameworkModule, Abp.EntityFramework, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,511 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.WebApi.AbpWebApiModule, Abp.Web.Api, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,511 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Web.AbpWebModule, Abp.Web, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,511 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Web.Mvc.AbpWebMvcModule, Abp.Web.Mvc, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,512 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.AbpZeroCoreModule, Abp.Zero, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,512 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.EntityFramework.AbpZeroEntityFrameworkModule, Abp.Zero.EntityFramework, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,512 [1 ] Abp.Modules.AbpModuleManager - Loaded module: GenisysIntranet.GenisysIntranetApplicationModule, GenisysIntranet.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,512 [1 ] Abp.Modules.AbpModuleManager - Loaded module: GenisysIntranet.GenisysIntranetCoreModule, GenisysIntranet.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,512 [1 ] Abp.Modules.AbpModuleManager - Loaded module: GenisysIntranet.GenisysIntranetDataModule, GenisysIntranet.EntityFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,512 [1 ] Abp.Modules.AbpModuleManager - Loaded module: GenisysIntranet.Web.GenisysIntranetWebModule, GenisysIntranet.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,512 [1 ] Abp.Modules.AbpModuleManager - Loaded module: GenisysIntranet.Api.GenisysIntranetWebApiModule, GenisysIntranet.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2015-10-08 12:37:08,516 [1 ] Abp.Modules.AbpModuleManager - 13 modules loaded. DEBUG 2015-10-08 12:37:10,166 [1 ] Abp.Localization.LocalizationManager - Initializing 4 localization sources. DEBUG 2015-10-08 12:37:10,170 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: Abp DEBUG 2015-10-08 12:37:10,171 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: AbpZero DEBUG 2015-10-08 12:37:10,171 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: GenisysIntranet DEBUG 2015-10-08 12:37:10,179 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: AbpWeb DEBUG 2015-10-08 12:37:11,367 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Found 3 classes defines auto mapping attributes DEBUG 2015-10-08 12:37:11,367 [1 ] Abp.AutoMapper.AbpAutoMapperModule - GenisysIntranet.Sessions.Dto.TenantLoginInfoDto DEBUG 2015-10-08 12:37:11,492 [1 ] Abp.AutoMapper.AbpAutoMapperModule - GenisysIntranet.Sessions.Dto.UserLoginInfoDto DEBUG 2015-10-08 12:37:11,501 [1 ] Abp.AutoMapper.AbpAutoMapperModule - GenisysIntranet.Web.Models.Account.TenantSelectionViewModel+TenantInfo DEBUG 2015-10-08 12:37:11,553 [1 ] Default - Dynamic web api controller is created for type 'GenisysIntranet.Roles.IRoleAppService' with service name 'app/role'. DEBUG 2015-10-08 12:37:11,554 [1 ] Default - Dynamic web api controller is created for type 'GenisysIntranet.Users.IUserAppService' with service name 'app/user'. DEBUG 2015-10-08 12:37:11,555 [1 ] Default - Dynamic web api controller is created for type 'GenisysIntranet.Sessions.ISessionAppService' with service name 'app/session'. ERROR 2015-10-08 12:37:33,675 [13 ] lers.Filters.AbpExceptionFilterAttribute - Abp.AbpException: There is no tenant with id: 1 at Abp.MultiTenancy.AbpTenantManager`3.

    Why are you trying to get Tenant Id 1 ??? There is no reason to HardCode those type of data!?

    my tenant id was 2 in database because i tried something....

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    The default tenant (which's id is assumed 1) is documented here: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Zero/Tenant-Management#default-tenant">http://www.aspnetboilerplate.com/Pages/ ... ult-tenant</a>

    "ASP.NET Boilerplate and module-zero assumes that there is a pre-defined tenant which's TenancyName is 'Default' and Id is 1. In a single-tenant application, this is used as as the single tenant."

    I know it's not good to make magic numbers like that. But ABP needs to refer the the default tenant. We should make an assumption and and I documented it.