2015-05-27 32 views
0

當我在Thinktecture IdManager中編輯用戶時,我可以更改他們的姓名,年齡和其他「自定義」屬性,但是當我嘗試更改他們的電子郵件地址或密碼時,我將自動調用自定義成員資格重新啓動存儲庫更新方法以保存更改並然後再次恢復變化。使用Thinktecture IdMgr + MembershipReboot無法更新用戶的電子郵件地址或密碼。

由於某種原因,控制器被AutoFac容器中間件調用了兩次。

IdMgr應用程序只有1個HTTP帖子,所以它不是客戶端問題。

第一個堆棧跟蹤...

Gaist.Authentication.dll!Gaist.Authentication.MR.MembershipRebootRepository.Update(Gaist.Authentication.Mongo.Models.CustomUser item) Line 71 C# 
[External Code]  
IdentityManager.MembershipReboot.dll!IdentityManager.MembershipReboot.MembershipRebootIdentityManagerService<Gaist.Authentication.Mongo.Models.CustomUser,Gaist.Authentication.Mongo.Models.CustomGroup>.SetPassword(Gaist.Authentication.Mongo.Models.CustomUser account, string password) Line 235 C# 
IdentityManager.dll!IdentityManager.ExpressionPropertyMetadata<Gaist.Authentication.Mongo.Models.CustomUser,string>.Set(object instance, string value) Line 87 C# 
IdentityManager.dll!IdentityManager.PropertyMetadataExtensions.TrySet(IdentityManager.PropertyMetadata property, object instance, string value, out IdentityManager.IdentityManagerResult result) Line 137 C# 
IdentityManager.dll!IdentityManager.PropertyMetadataExtensions.TrySet(System.Collections.Generic.IEnumerable<IdentityManager.PropertyMetadata> properties, object instance, string type, string value, out IdentityManager.IdentityManagerResult result) Line 123 C# 
IdentityManager.MembershipReboot.dll!IdentityManager.MembershipReboot.MembershipRebootIdentityManagerService<Gaist.Authentication.Mongo.Models.CustomUser,Gaist.Authentication.Mongo.Models.CustomGroup>.SetUserProperty(System.Collections.Generic.IEnumerable<IdentityManager.PropertyMetadata> propsMeta, Gaist.Authentication.Mongo.Models.CustomUser user, string type, string value) Line 590 C# 
IdentityManager.MembershipReboot.dll!IdentityManager.MembershipReboot.MembershipRebootIdentityManagerService<Gaist.Authentication.Mongo.Models.CustomUser,Gaist.Authentication.Mongo.Models.CustomGroup>.SetUserPropertyAsync(string subject, string type, string value) Line 503 C# 
IdentityManager.dll!IdentityManager.Api.Models.Controllers.UserController.SetPropertyAsync(string subject, string type) Line 205 C# 
[External Code]  
IdentityManager.dll!IdentityManager.Configuration.Hosting.KatanaDependencyResolver.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) Line 35 C# 
[External Code]  
IdentityManager.dll!IdentityManager.Configuration.Hosting.AutofacContainerMiddleware.Invoke(System.Collections.Generic.IDictionary<string,object> env) Line 51 C# 
[External Code]  
IdentityManager.dll!Owin.IdentityManagerAppBuilderExtensions.UseIdentityManager(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next) Line 55 C# 
[Resuming Async Method]  
[External Code] 

第二堆棧跟蹤...

Gaist.Authentication.dll!Gaist.Authentication.MR.MembershipRebootRepository.Update(Gaist.Authentication.Mongo.Models.CustomUser item) Line 71 C# 
[External Code] 
IdentityManager.MembershipReboot.dll!IdentityManager.MembershipReboot.MembershipRebootIdentityManagerService<Gaist.Authentication.Mongo.Models.CustomUser,Gaist.Authentication.Mongo.Models.CustomGroup>.SetUserPropertyAsync(string subject, string type, string value) Line 511 C# 
IdentityManager.dll!IdentityManager.Api.Models.Controllers.UserController.SetPropertyAsync(string subject, string type) Line 205 C# 
[External Code] 
IdentityManager.dll!IdentityManager.Configuration.Hosting.KatanaDependencyResolver.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) Line 35 C# 
[External Code] 
IdentityManager.dll!IdentityManager.Configuration.Hosting.AutofacContainerMiddleware.Invoke(System.Collections.Generic.IDictionary<string,object> env) Line 51 C# 
[External Code] 
IdentityManager.dll!Owin.IdentityManagerAppBuilderExtensions.UseIdentityManager(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next) Line 55 C# 
[Resuming Async Method] 
[External Code] 

回答

0

這是發生,因爲自帶開箱的MembershipRebootIdentityManagerService實現是假設該存儲庫將基於實體框架,並且調用save兩次將工作在EF上下文的同一實例上,因此也是同一個實體。

我的回購實施沒有這樣工作,所以它加載一個未保存的實體,然後覆蓋設置。

我不得不將我的存儲庫凍結在存儲庫的整個生命週期中進行編輯的實體。

相關問題