Base solution for your next web application

Activities of "sddev"

Hi,

We're trying to extend the OrganizationUnit entity to add some additional items to it.

public class OrganisationUnit : OrganizationUnit
    {
		public virtual bool IsCompany { get; set; }
    }

The updates will allow department information to be added - eg Department Phone Number, Starting Hours etc.

Now when using the Repository against OrganizationUnit, we get all the results but without the additional fields. But when using a Repository against OrganisationUnit we get no results whatsoever:

public class OrganisationUnitManager : IDomainService
{
   private readonly IRepository<OrganisationUnit, long> _organisationUnitRepository;
   private readonly IRepository<OrganizationUnit, long> _organizationUnitRepository;
      
   public OrganisationUnitManager(IRepository<OrganisationUnit, long> organisationUnitRepository, IRepository<OrganizationUnit, long> organizationUnitRepository, IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository)
   {
      _organisationUnitRepository = organisationUnitRepository;
      _organizationUnitRepository = organizationUnitRepository;
   }
 
 
public async Task<OrganizationUnit> GetOUForUser(long userId)
{
   var orgs = _organisationUnitRepository.GetAll(); // Returns 0 Results - with the extended columns
   var orgz = _organizationUnitRepository.GetAll(); // Returns 8 Results - without the extended columns
   return orgUnit;
}
}

Any thoughts would be great.

Simon

That's brilliant. Thank you for this. I changed the Discriminator column to be the new name and was able to get all the results, and strangely enough, in both repositorys! So it looks like I might not need to change anything. I'll need to do a bit more testing, but Im happy this is the answer.

Thank you so much!

Simon

Hi,

We're setting up LDAP Authentication using the guides.

So far, LDAP Authentication works flawlessly. However it doesn't seem to save in the database.

Although the CreateAsync methods seem to work, ie

return await this.Store.CreateAsync(user, this.CancellationToken);

it appears that in AbpLoginManager.cs, this line,

wait UnitOfWorkManager.Current.SaveChangesAsync();

does not work.

Because when in the function LoginAsyncInternal, when the following line is called:

return await CreateLoginResultAsync(user, tenant);

the

await UserManager.UpdateAsync(user);

line in the function is unable to run because it cannot find the user.

Could you advise further?

Regards, Simon Dean

Hi,

I have located the following exception, which doesn't really tell me anything as far as I can. Interestingly, every time it tries to create a user, the user id does increase. I started on 15, it's now on 21. However nothing seems to get saved in the database which is rather curious.

The logs are:

ERROR 2018-09-13 16:00:59,135 [5    ] Mvc.ExceptionHandling.AbpExceptionFilter - There is no such an entity. Entity type: ACUTEC.TimeAndAttendance.Authorization.Users.User, id: 21
Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: ACUTEC.TimeAndAttendance.Authorization.Users.User, id: 21
   at Abp.Domain.Repositories.AbpRepositoryBase`2.&lt;GetAsync&gt;d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Abp.Authorization.Users.AbpUserStore`2.&lt;GetUserNameFromDatabaseAsync&gt;d__88.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Abp.Authorization.Users.AbpUserManager`2.&lt;UpdateAsync&gt;d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Abp.Authorization.AbpLogInManager`3.&lt;CreateLoginResultAsync&gt;d__38.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Abp.Authorization.AbpLogInManager`3.&lt;LoginAsyncInternal&gt;d__37.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Abp.Authorization.AbpLogInManager`3.&lt;LoginAsync&gt;d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at ACUTEC.TimeAndAttendance.Web.Controllers.TokenAuthController.<GetLoginResultAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at ACUTEC.TimeAndAttendance.Web.Controllers.TokenAuthController.&lt;Authenticate&gt;d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()
INFO  2018-09-13 16:00:59,657 [5    ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.
INFO  2018-09-13 16:00:59,769 [5    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action ACUTEC.TimeAndAttendance.Web.Controllers.TokenAuthController.Authenticate (ACUTEC.TimeAndAttendance.Web.Core) in 119691.8196ms
INFO  2018-09-13 16:00:59,786 [5    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 121212.3609ms 404 application/json; charset=utf-8

If I try to manually run the commands in the debug stack on line 323 and 334 of AbpLoginManager (ie await UserManager.CreateAsync(user) and await UnitOfWorkManager.Current.SaveChangesAsync() I get the following results:

CreateAsync: The function evaluation requires all threads to run SaveChangesAsync: Cannot apply unary operator to non-primitive value

Im not seeing anything obvious however.

Regards, Simon Dean

Sorry for the delay in updating.

We're using a version of ASP.NET Zero that was originally downloaded in April.

Through the login page, we're selecting a Tenant, and then going to Login. The TryLoginFromExternalAuthenticationSources as far as I know should be trying to log in to our LDAP Server and indeed this works fine. However then when trying to create the user, it fails as above.

Regards, Simon Dean

Hi,

We downloaded 5.3.0 a while back choosing AspNetZeroAngular2 (.NET Core & Angular).

However when choosing the framework, I seem to recall some differences and limitations on the .NET Core 2.0 compared to the .NET Framework 4.6

Could you confirm what those differences/limitations were because I can no longer find these.

Regards, Simon Dean

Thanks for that, however it was more the differences between the Framework selections. Downloading .NET Zero 5.3.0 gives options for Framework 4.6 and .NET Core 2.0

Could you advise on the differences? I believe SignalR was one such limitation.

Regards Simon Dean

We're just doing an upgrade from 5.3.0 to 5.6.2

We're using a .NET Core and Angular installation.

The backend has gone through and works fine as far as I can see. However we can now no longer login.

We're just getting a failure in Angular showing status 500, Internal Server Error, url - /api/TokenAuth/Authenticate

The only thing that I can see is that in RepositoryExtensions.cs, and the lines:

public static async Task EnsureCollectionLoadedAsync<TEntity, TPrimaryKey, TProperty>(this IRepository<TEntity, TPrimaryKey> repository, TEntity entity, Expression<Func<TEntity, IEnumerable<TProperty>>> collectionExpression, CancellationToken cancellationToken = default (CancellationToken)) where TEntity : class, IEntity<TPrimaryKey> where TProperty : class { ISupportsExplicitLoading<TEntity, TPrimaryKey> supportsExplicitLoading = ProxyHelper.UnProxy((object) repository) as ISupportsExplicitLoading<TEntity, TPrimaryKey>; if (supportsExplicitLoading == null) return; await supportsExplicitLoading.EnsureCollectionLoadedAsync<TProperty>(entity, collectionExpression, cancellationToken); }

supportsExplicitLoading isn't null, it is undefined?

Any thoughts?

Simon

Ignore. We didn't set the right connectionString.

Showing 1 to 10 of 20 entries