you are right, userid 1 is the host admin and its tenantid was null.
one more related question. my entity is fully audited. so creator id is coming by default. so i dont think i need to keep another field to keep track of the owner of the entity, right? can i just use it and relate it to the user table over CreatorUserId field?
thanks -ulker
SELECT * FROM StudentRequests AS sr INNER JOIN FormTypes AS ft ON ft.Id = sr.FormTypeId INNER JOIN AbpUsers AS au ON au.Id = sr.UserId WHERE sr.UserId=1
this is the sql i need and it returns one record.
no, no multi tenancy.
Manager is a string field and in my example input.Manager is null so that statement is not even included in generated sql. here it is: i hate the sql ef generates but it is what it is. i dont see anything wrong with it unless an unnecessary statement is added and its causing the null result.
exec sp_executesql N'SELECT
[Extent1].[Id] AS [Id],
[Extent1].[UserId] AS [UserId],
[Extent1].[FormTypeId] AS [FormTypeId],
[Extent1].[Notes] AS [Notes],
[Extent1].[EnglishCount] AS [EnglishCount],
[Extent1].[TurkishCount] AS [TurkishCount],
[Extent1].[IsReady] AS [IsReady],
[Extent1].[IsDeleted] AS [IsDeleted],
[Extent1].[DeleterUserId] AS [DeleterUserId],
[Extent1].[DeletionTime] AS [DeletionTime],
[Extent1].[LastModificationTime] AS [LastModificationTime],
[Extent1].[LastModifierUserId] AS [LastModifierUserId],
[Extent1].[CreationTime] AS [CreationTime],
[Extent1].[CreatorUserId] AS [CreatorUserId],
[Extent2].[Id] AS [Id1],
[Extent2].[Name] AS [Name],
[Extent2].[Manager] AS [Manager],
[Extent2].[PeopleToNotify] AS [PeopleToNotify],
[Extent2].[IsForStudent] AS [IsForStudent],
[Extent2].[IsForStaff] AS [IsForStaff],
[Extent3].[Id] AS [Id2],
[Extent3].[ProfilePictureId] AS [ProfilePictureId],
[Extent3].[ShouldChangePasswordOnNextLogin] AS [ShouldChangePasswordOnNextLogin],
[Extent3].[TenantId] AS [TenantId],
[Extent3].[Name] AS [Name1],
[Extent3].[Surname] AS [Surname],
[Extent3].[UserName] AS [UserName],
[Extent3].[Password] AS [Password],
[Extent3].[EmailAddress] AS [EmailAddress],
[Extent3].[IsEmailConfirmed] AS [IsEmailConfirmed],
[Extent3].[EmailConfirmationCode] AS [EmailConfirmationCode],
[Extent3].[PasswordResetCode] AS [PasswordResetCode],
[Extent3].[LastLoginTime] AS [LastLoginTime],
[Extent3].[IsActive] AS [IsActive],
[Extent3].[IsDeleted] AS [IsDeleted1],
[Extent3].[DeleterUserId] AS [DeleterUserId1],
[Extent3].[DeletionTime] AS [DeletionTime1],
[Extent3].[LastModificationTime] AS [LastModificationTime1],
[Extent3].[LastModifierUserId] AS [LastModifierUserId1],
[Extent3].[CreationTime] AS [CreationTime1],
[Extent3].[CreatorUserId] AS [CreatorUserId1]
FROM (SELECT [Var_4].[Id] AS [Id], [Var_4].[UserId] AS [UserId], [Var_4].[FormTypeId] AS [FormTypeId], [Var_4].[Notes] AS [Notes], [Var_4].[EnglishCount] AS [EnglishCount], [Var_4].[TurkishCount] AS [TurkishCount], [Var_4].[IsReady] AS [IsReady], [Var_4].[IsDeleted] AS [IsDeleted], [Var_4].[DeleterUserId] AS [DeleterUserId], [Var_4].[DeletionTime] AS [DeletionTime], [Var_4].[LastModificationTime] AS [LastModificationTime], [Var_4].[LastModifierUserId] AS [LastModifierUserId], [Var_4].[CreationTime] AS [CreationTime], [Var_4].[CreatorUserId] AS [CreatorUserId]
FROM [dbo].[StudentRequests] AS [Var_4]
WHERE ([Var_4].[IsDeleted] = @DynamicFilterParam_SoftDelete_IsDeleted) OR (@DynamicFilterParam_SoftDelete_DynamicFilterIsDisabled IS NOT NULL) ) AS [Extent1]
INNER JOIN [dbo].[FormTypes] AS [Extent2] ON [Extent1].[FormTypeId] = [Extent2].[Id]
INNER JOIN (SELECT [Var_5].[Id] AS [Id], [Var_5].[ProfilePictureId] AS [ProfilePictureId], [Var_5].[ShouldChangePasswordOnNextLogin] AS [ShouldChangePasswordOnNextLogin], [Var_5].[TenantId] AS [TenantId], [Var_5].[Name] AS [Name], [Var_5].[Surname] AS [Surname], [Var_5].[UserName] AS [UserName], [Var_5].[Password] AS [Password], [Var_5].[EmailAddress] AS [EmailAddress], [Var_5].[IsEmailConfirmed] AS [IsEmailConfirmed], [Var_5].[EmailConfirmationCode] AS [EmailConfirmationCode], [Var_5].[PasswordResetCode] AS [PasswordResetCode], [Var_5].[LastLoginTime] AS [LastLoginTime], [Var_5].[IsActive] AS [IsActive], [Var_5].[IsDeleted] AS [IsDeleted], [Var_5].[DeleterUserId] AS [DeleterUserId], [Var_5].[DeletionTime] AS [DeletionTime], [Var_5].[LastModificationTime] AS [LastModificationTime], [Var_5].[LastModifierUserId] AS [LastModifierUserId], [Var_5].[CreationTime] AS [CreationTime], [Var_5].[CreatorUserId] AS [CreatorUserId]
FROM [dbo].[AbpUsers] AS [Var_5]
WHERE ((([Var_5].[TenantId] IS NULL) AND (@DynamicFilterParam_MayHaveTenant_tenantId IS NULL)) OR (([Var_5].[TenantId] IS NOT NULL) AND ([Var_5].[TenantId] = @DynamicFilterParam_MayHaveTenant_tenantId)) OR (@DynamicFilterParam_MayHaveTenant_DynamicFilterIsDisabled IS NOT NULL)) AND (([Var_5].[IsDeleted] = @DynamicFilterParam_SoftDelete_IsDeleted) OR (@DynamicFilterParam_SoftDelete_DynamicFilterIsDisabled IS NOT NULL)) ) AS [Extent3] ON [Extent1].[UserId] = [Extent3].[Id]',N'@DynamicFilterParam_SoftDelete_IsDeleted bit,@DynamicFilterParam_SoftDelete_DynamicFilterIsDisabled bit,@DynamicFilterParam_MayHaveTenant_tenantId int,@DynamicFilterParam_MayHaveTenant_DynamicFilterIsDisabled bit',@DynamicFilterParam_SoftDelete_IsDeleted=0,@DynamicFilterParam_SoftDelete_DynamicFilterIsDisabled=NULL,@DynamicFilterParam_MayHaveTenant_tenantId=1,@DynamicFilterParam_MayHaveTenant_DynamicFilterIsDisabled=NULL
Hi, i have 3 entities: StudentRequest, FormType, and User (abp default) StudentRequest is related to FormType through FormTypeId, and related to User through UserId.
i have one record in db and i was expecting the following linq statement to get me what i want but it returns nothing. var toReturn = this._studentRequestRepository.GetAll() .Include(p => p.FormType) .Include(p => p.User) .WhereIf(input.UserId > 0, t => t.UserId == input.UserId) .WhereIf(!string.IsNullOrEmpty(input.Manager), t => t.FormType.Manager == input.Manager) .ToList();
i looked at the produced sql and there are a lot of tenantid related extra AND OR statements. Not sure what is causing the issue. Do you see anything wrong with the statement?
thanks -ulker
I have the permissions all setup. Just didnt know i had to create an abstract parent route.
thank you. -ulker
Hi, i am trying to create a new menu item but i get an error i cant figure out. here is my menu definition inside appnavigationprovider class:
.AddItem(new MenuItemDefinition(
PageNames.App.Forms.Root,
L("Forms"),
icon: "glyphicon glyphicon-wrench"
).AddItem(new MenuItemDefinition(
PageNames.App.Forms.StudentRequest,
L("StudentRequest"),
url: "forms.studentrequest",
icon: "icon-briefcase",
requiredPermissionName: AppPermissions.Pages_Forms_StudentRequest
)
)
)
and here is my routing in app.js
if (abp.auth.hasPermission('Pages.Forms.StudentRequest')) {
$stateProvider.state('forms.studentrequest', {
url: '/forms/studentrequest',
templateUrl: '~/App/tenant/views/forms/studentrequest.cshtml',
menu: 'Forms.StudentRequest'
});
}
and here is the error i get: Error: Could not resolve 'forms.studentrequest' from state ''
am i missing something here? thanks