today I tried the Abp for .NET core I copied the same code for from my old project I run the project the difference in calling the APIs was like this
MVC 5.x was 30 milliseconds
ASP.NET Core was 735 milliseconds
Which is very bad performance of course. and I advice all the developers to try the Abp core before starting any project.
Hope in the future it will be fixed.
How to add ValidateAntiForgeryToken attribute for the generated Application Service API ?
I do not want to add ValidateAntiForgeryToken for all of them.
I am getting this exception after updating Abp to latest version. This exception I am getting when use
IApplicationLanguageManager
Example
ApplicationLanguageManager.GetLanguagesAsync(null)
I get this exception.
In Abp 0.9.0 there is no exception.
System.MissingMethodException was unhandled by user code
HResult=-2146233069
Message=Method not found: 'Void EntityFramework.DynamicFilters.DynamicFilterExtensions.Filter(System.Data.Entity.DbModelBuilder, System.String, System.Linq.Expressions.Expression1<System.Func
3<!!0,!!1,Boolean>>, !!1)'.
Source=Abp.EntityFramework
StackTrace:
at Abp.EntityFramework.AbpDbContext.OnModelCreating(DbModelBuilder modelBuilder)
at System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder()
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 129
at Abp.EntityFramework.AbpDbContext..ctor(String nameOrConnectionString) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\AbpDbContext.cs:line 73
at myproject.FrontEnd.EntityFramework.FrontEndDbContext..ctor(String nameOrConnectionString) in D:\myproject\myprojectFrontEnd\myproject.FrontEnd.EntityFramework\EntityFramework\FrontEndDbContext.cs:line 43
InnerException:
I am getting this exception after updating Abp to latest version. This exception I am getting when use
IApplicationLanguageManager
Example
ApplicationLanguageManager.GetLanguagesAsync(null)
I get this exception.
In Abp 0.9.0 there is no exception.
System.MissingMethodException was unhandled by user code
HResult=-2146233069
Message=Method not found: 'Void EntityFramework.DynamicFilters.DynamicFilterExtensions.Filter(System.Data.Entity.DbModelBuilder, System.String, System.Linq.Expressions.Expression1<System.Func
3<!!0,!!1,Boolean>>, !!1)'.
Source=Abp.EntityFramework
StackTrace:
at Abp.EntityFramework.AbpDbContext.OnModelCreating(DbModelBuilder modelBuilder)
at System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder()
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 129
at Abp.EntityFramework.AbpDbContext..ctor(String nameOrConnectionString) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\AbpDbContext.cs:line 73
at myproject.FrontEnd.EntityFramework.FrontEndDbContext..ctor(String nameOrConnectionString) in D:\myproject\myprojectFrontEnd\myproject.FrontEnd.EntityFramework\EntityFramework\FrontEndDbContext.cs:line 43
InnerException:
I want to use Dapper as Data Access layer also I must be able to connect to two databases. now I can create two entity framework context and do not use the entity framework just use the connection string from the context. but I would like build Dapper integration for boilerplate and contribute on this. How can I start ? I looked at Abp.EntityFramework My question is just a general guide lines
which classes I should implement and How to register them and let the boilerplate use them UnitOfWorkBase AbpRepositoryBase
Is there are any other things I should pay attention to them ?
Could any one please explain how to use ImpersonatorTenantId and ImpersonatorUserId ?
I did not find any documentation about where to set these values and how to use them
UnitOfWorkManager.Current is null inside the the AppService classes if I did not add [UnitOfWork] Attribute in the controller action
[HttpPost]
[UnitOfWork]
//[ValidateAntiForgeryToken()]
public virtual async Task<ActionResult> Register(SignUpUserInput model)
{
var ttt = _unitOfWorkManager.Current;
//await _userAppService.SignUpUser(model);
//throw new UserFriendlyException("Test UI Exception");
try
{
CheckModelState();
//var validateCaptchaResult = ValidateCaptcha();
//if (!validateCaptchaResult.Succeeded)
//{
// throw new Exception(validateCaptchaResult.Errors.FirstOrDefault() ?? string.Empty);
//}
await _userAppService.SignUpUser(model);
return RedirectToAction("RegistrationCompleted");
}
catch (Exception ex)
{
ViewBag.ErrorMessage = ex.Message;
if (ex.InnerException != null)
{
ViewBag.ErrorMessage += "<br>" + ex.InnerException.Message;
}
return View(model);
}
}
The code above if I removed [UnitOfWork] attribute on the Controller action the UnitOfWorkManager.Current will be null insdie the _userAppService.
Is that normal by Design ? Should I add [UnitOfWork] to all controller actions ?
When I use application service inside a try catch in the controller even if the app service method throw an exception the unit of work commit changes to the DB because I am using try catch block for example
[HttpPost]
[UnitOfWork]
//[ValidateAntiForgeryToken()]
public virtual async Task<ActionResult> Register(SignUpUserInput model)
{
var ttt = _unitOfWorkManager.Current;
//await _userAppService.SignUpUser(model);
//throw new UserFriendlyException("Test UI Exception");
try
{
CheckModelState();
//var validateCaptchaResult = ValidateCaptcha();
//if (!validateCaptchaResult.Succeeded)
//{
// throw new Exception(validateCaptchaResult.Errors.FirstOrDefault() ?? string.Empty);
//}
await _userAppService.SignUpUser(model);
return RedirectToAction("RegistrationCompleted");
}
catch (Exception ex)
{
ViewBag.ErrorMessage = ex.Message;
if (ex.InnerException != null)
{
ViewBag.ErrorMessage += "<br>" + ex.InnerException.Message;
}
return View(model);
}
}
The above code even if _userAppService.SignUpUser(model) throw an exception the unit of work will commit the changes. If I removed the try catch the unit if work rollback the changes. Is there is any way to rollabck the changes manually ?
This Topic related to #170 Hello Halil I was reading about unit of work and How aspnetboilerplate automatically start a transaction on calling any Application Service method here <a class="postlink" href="http://aspnetboilerplate.com/Pages/Docu">http://aspnetboilerplate.com/Pages/Docu</a> ... it-Of-Work Do you mean that Starting the MSDTC on the server will fix the issues regarding starting Two transaction ? Dose aspnetboilerplate unit of work deal with this scenarios where multi tenant application should use different database for each tenant ? Please help because I am new to aspnetboilerplate and I also should use Single Application/Multi Database approach.
My scenario is Single Deployment - Multiple Database in the below link I just want to make sure that aspnetboilerplate work with Single Deployment - Multiple Database or How I should implement my Application Service classes in order to get aspnetboilerplate works with Single Deployment - Multiple Database <a class="postlink" href="http://aspnetboilerplate.com/Pages/Docu">http://aspnetboilerplate.com/Pages/Docu</a> ... ti-Tenancy
My scenario workflow is like this