I am trying to extend the Roles to Organization. Can you point me in the right direction ?
I also need to know where to override GetRolesforUser, so that I can override with GetRolesforUser(long OUId).
I am using Abp 9.7 and latest version of Abp Zero. I wasn't using the test cases before and decided to start using it now, so can't say what could have broke this. Here is the complete exception :
Test Name: XXXXX.YYYYYYY.Tests.Auditing.AuditLogAppService_Tests.Test1(cultureName: "en") Test FullName: XXXXX.YYYYYYY.Tests.Auditing.AuditLogAppService_Tests.Test1 (0519c3fdd562f69227b885ca8782c51d90c41c79) Test Source: C:\Source Code\ZZZZZ\DEVCODE\Tests\XXXXX.YYYYYYY.Tests\Auditing\AuditLogAppService_Tests.cs : line 30 Test Outcome: Failed Test Duration: 0:00:00.001
Result StackTrace:
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)
at Castle.Windsor.WindsorContainer.ResolveT
at Abp.Dependency.IocManager.ResolveT in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Dependency\IocManager.cs:line 160
at XXXXX.YYYYYYY.Tests.AppTestBase.UsingDbContext(Nullable1 tenantId, Action
1 action) in C:\Source Code\ZZZZZ\DEVCODE\Tests\XXXXX.YYYYYYY.Tests\AppTestBase.cs:line 157
at XXXXX.YYYYYYY.Tests.AppTestBase.UsingDbContext(Action1 action) in C:\Source Code\ZZZZZ\DEVCODE\Tests\XXXXX.YYYYYYY.Tests\AppTestBase.cs:line 135 at XXXXX.YYYYYYY.Tests.AppTestBase..ctor() in C:\Source Code\ZZZZZ\DEVCODE\Tests\XXXXX.YYYYYYY.Tests\AppTestBase.cs:line 42 at XXXXX.YYYYYYY.Tests.Auditing.AuditLogAppService_Tests..ctor() in C:\Source Code\ZZZZZ\DEVCODE\Tests\XXXXX.YYYYYYY.Tests\Auditing\AuditLogAppService_Tests.cs:line 20 ----- Inner Stack Trace ----- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) ----- Inner Stack Trace ----- at System.Linq.Enumerable.Single[TSource](IEnumerable
1 source, Func2 predicate) at System.Data.Entity.Utilities.DbProviderManifestExtensions.GetStoreTypeFromName(DbProviderManifest providerManifest, String name) at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.ConfigureColumn(EdmProperty column, EntityType table, DbProviderManifest providerManifest) at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(EdmProperty column, EntityType table, DbProviderManifest providerManifest, Boolean allowOverride, Boolean fillFromExistingConfiguration) at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.<>c__DisplayClass4.<Configure>b__3(Tuple
2 pm)
at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable1 ts, Action
1 action)
at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(IEnumerable1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride, Boolean fillFromExistingConfiguration) at System.Data.Entity.ModelConfiguration.Configuration.Types.StructuralTypeConfiguration.ConfigurePropertyMappings(IList
1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride)
at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigurePropertyMappings(DbDatabaseMapping databaseMapping, EntityType entityType, DbProviderManifest providerManifest, Boolean allowOverride)
at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EntityType entityType, DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest)
at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntityTypes(DbDatabaseMapping databaseMapping, ICollection1 entitySets, DbProviderManifest providerManifest) at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.Configure(DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest) at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo) at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) at System.Data.Entity.Internal.RetryLazy
2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes()
at System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()
at Abp.EntityFramework.AbpDbContext.RegisterToChanges() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\AbpDbContext.cs:line 126
at Abp.Zero.EntityFramework.AbpZeroDbContext`3..ctor(DbConnection dbConnection, Boolean contextOwnsConnection) in D:\Halil\GitHub\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\AbpZeroDbContext.cs:line 81
at XXXXX.YYYYYYY.EntityFramework.YYYYYYYDbContext..ctor(DbConnection dbConnection) in C:\Source Code\ZZZZZ\DEVCODE\XXXXX.YYYYYYY.EntityFramework\EntityFramework\YYYYYYYDbContext.cs:line 689
Result Message:
Castle.MicroKernel.ComponentActivator.ComponentActivatorException : ComponentActivator: could not instantiate XXXXX.YYYYYYY.EntityFramework.YYYYYYYDbContext
---- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
-------- System.InvalidOperationException : Sequence contains no matching element
Castle.MicroKernel.ComponentActivator.ComponentActivatorException : ComponentActivator: could not instantiate xxxx.xxx.EntityFramework.CORPACCOUNTINGDbContext ---- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. -------- System.InvalidOperationException : Sequence contains no matching element
I am getting this error when I run the test cases provided by AbpZero.
Any ideas?
Hi Hilkan -
It would be nice to have an example on how to use the new extension method GraphDiff. This will guide us to do further implementation
Thanks Hilkan the new release fixed it
I made this change and it works :
public async Task<PagedResultOutput<AuditLogListDto>> GetAuditLogs(GetAuditLogsInput input) { var query = CreateAuditLogAndUsersQuery(input); var resultCount = await query.CountAsync(); var results = await query // .AsNoTracking() .OrderBy(input.Sorting) .PageBy(input) .ToListAsync(); var auditLogListDtos = ConvertToAuditLogListDtos(results); return new PagedResultOutput<AuditLogListDto>(resultCount, auditLogListDtos); }
Is this correct?
I have upgraded to the latest version of Abp and my audit Log has stopped working. Below is the error I am getting
ERROR 2016-06-06 05:10:00,794 [70 ] lers.Filters.AbpExceptionFilterAttribute - Attaching an entity of type 'xxxxx.xxxxx.Authorization.Users.User' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.
System.InvalidOperationException: Attaching an entity of type 'xxxxx.xxxxx.Authorization.Users.User' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.
at System.Data.Entity.Core.Objects.ObjectContext.VerifyRootForAdd(Boolean doAttach, String entitySetName, IEntityWrapper wrappedEntity, EntityEntry existingEntry, EntitySet& entitySet, Boolean& isNoOperation)
at System.Data.Entity.Core.Objects.ObjectContext.AttachTo(String entitySetName, Object entity)
at System.Data.Entity.Internal.Linq.InternalSet1.ActOnSet(Action action, EntityState newState, Object entity, String methodName) at System.Data.Entity.Internal.Linq.InternalSet
1.Attach(Object entity)
at Abp.EntityFramework.Uow.EfUnitOfWork.ObjectContext_ObjectMaterialized(DbContext dbContext, ObjectMaterializedEventArgs e)
at System.Data.Entity.Core.Objects.ObjectContext.OnObjectMaterialized(Object entity)
at System.Data.Entity.Core.Common.Internal.Materialization.Shaper.RaiseMaterializedEvents()
at System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.StopMaterializingElement() at System.Data.Entity.Core.Common.Internal.Materialization.Shaper
1.SimpleEnumerator.<MoveNextAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.<ForEachAsync>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at xxxxx.xxxxx.Auditing.AuditLogAppService.<GetAuditLogs>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at xxxxx.xxxxx.Interceptors.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__1
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
I am not sure what resolved it, but when I deleted all the resources and tried again it worked.
Any update on how to troubleshoot ?
o language defined in this application.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Abp.AbpException: No language defined in this application.
Source Error:
Line 50: <body class="corporate"> Line 51: Line 52: @Html.Action("Header", "Layout", new { currentPageName = ViewBag.CurrentPageName }) Line 53: Line 54: <div class="main">
Source File: d:\home\site\wwwroot\Views\Layout_Layout.cshtml Line: 52
Stack Trace:
[AbpException: No language defined in this application.] Abp.Localization.LanguageManager.GetCurrentLanguage() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Localization\LanguageManager.cs:29
Note : It works fine when I debug from my Visual Studio and connect to Azure DB