actually i'm going to use ng-messages directive to implement validation messages but the problem is i have to edit every single view to achieve that , i'm thinking for solution to achieve that in simple way and write less code thank you anyway
Hello i need to implement validation messages in spa forms because most of fields are different in validation some is required some has max-length some has min-length , some use regex and so on any suggestions i know about ng-messages in angular but i think i have to write a lot of code to handle all validation messages on my project is there any way to make validation messages shared between of my views thanks in advance
Actually it occurs often please refer to the previous post of mine try the code and it will fix the problem let me know please of your progress by the way if you want to debug seed method effects you can use this code in seed method
// Debugging Package Manager Console Update-Database Seed Method
if (System.Diagnostics.Debugger.IsAttached == false)
System.Diagnostics.Debugger.Launch();
thank you very much for this information i didn't know it before actually it fixed my problem
for the second problem actually i'm sorry it was my mistake it work now just fine i had a spelling mistake in name of dictionary provider AbpWeb :D i appreciate your help
actually i tried as you mention
using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
{
patient.IsActive = false;
_patientRepository.Update(patient);
unitOfWork.Complete();
}
but i got this error
nHandling.AbpApiExceptionFilterAttribute - An entity object cannot be referenced by multiple instances of IEntityChangeTracker.
System.InvalidOperationException: An entity object cannot be referenced by multiple instances of IEntityChangeTracker.
at System.Data.Entity.Core.Objects.ObjectContext.VerifyContextForAddOrAttach(IEntityWrapper wrappedEntity)
at System.Data.Entity.Core.Objects.ObjectContext.AttachSingleObject(IEntityWrapper wrappedEntity, EntitySet entitySet)
at System.Data.Entity.Core.Objects.ObjectContext.AttachTo(String entitySetName, Object entity)
at System.Data.Entity.Internal.Linq.InternalSet`1.<>c__DisplayClassa.<Attach>b__9()
at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
at System.Data.Entity.Internal.Linq.InternalSet`1.Attach(Object entity)
at System.Data.Entity.DbSet`1.Attach(TEntity entity)
at Abp.EntityFramework.Repositories.EfRepositoryBase`3.AttachIfNot(TEntity entity) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 208
at Castle.Proxies.PatientRepositoryProxy.AttachIfNot_callback(Patient entity)
at Castle.Proxies.Invocations.EfRepositoryBase`3_AttachIfNot_26.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 53
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 45
at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.PatientRepositoryProxy.AttachIfNot(Patient entity)
at Abp.EntityFramework.Repositories.EfRepositoryBase`3.Update(TEntity entity) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 151
at Castle.Proxies.PatientRepositoryProxy.Update_callback(Patient entity)
at Castle.Proxies.Invocations.EfRepositoryBase`3_Update_26.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 53
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 45
at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.PatientRepositoryProxy.Update(Patient entity)
far away of this problem i always got this warning Abp.Logging.LogHelper - Can not find 'InternalServerError' in localization source 'AbpWeb'!
although i extended AbpWeb sources as explained here but it doesn't work [http://www.aspnetboilerplate.com/Pages/Documents/Localization#DocExtending])
thank you
Hello, in my service i have condition that if true then must make some changes to database, but because i'm using UserFriendlyException it rollback all changes made, so i tried unitOfWork.Complete() but unfortunately the same behaviour
///////////////////////////////////
/////////// rest of code /////////
///////////////////////////////////
if (condition)
{
using (var unitOfWork = _unitOfWorkManager.Begin())
{
patient.IsActive = false;
_patientRepository.Update(patient);
unitOfWork.Complete();
}
throw new UserFriendlyException(18, L("CannotBookAppointmentIsAgeRestriction"), "");
}
/////////// another conditions /////////
///////////////////////////////////
/////////// rest of code /////////
///////////////////////////////////
of course i'm sure that i disable cache in all browsers i use to test my application but i'll test it again deeply and i'll let you know if there are something required your attention
actually it run from the first try but not all code get executed
so i use this code to solve the problem
private readonly bool _pendingMigrations;
public Configuration()
{
AutomaticMigrationsEnabled = true;
ContextKey = "ProjectName";
// Check if there are migrations pending to run, this can happen if database doesn't exists or if there was any change in the schema
var migrator = new DbMigrator(this);
_pendingMigrations = migrator.GetPendingMigrations().Any();
// If there are pending migrations run migrator.Update() to create/update the database then run the Seed() method to populate
// the data if necessary
if (_pendingMigrations)
{
migrator.Update();
Seed(new EntityFramework.ProjectNameDbContext());
}
}
protected override void Seed(EntityFramework.ProjectNameDbContext context)
{
context.DisableAllFilters();
/////////////////// rest of code ////////////////
context.SaveChanges();
base.Seed(context);
}
hello i have a problem in seed method that it doesn't run all code inside from the first time so i have to run update-database -verbose several times to get all code executed
protected override void Seed(EntityFramework.UmbrellaDbContext context)
{
context.DisableAllFilters();
context.Database.ExecuteSqlCommand("DBCC CHECKIDENT('AbpUsers', RESEED, 101)");
context.Database.ExecuteSqlCommand("DBCC CHECKIDENT('HmPatients', RESEED, 10001)");
context.Database.ExecuteSqlCommand("DBCC CHECKIDENT('HmDoctors', RESEED, 201)");
if (Tenant == null)
{
//Host seed
new InitialHostDbBuilder(context).Create();
//Default tenant seed (in host database).
new DefaultTenantBuilder(context).Create();
new TenantRoleAndUserBuilder(context, 1).Create();
}
else
{
//You can add seed for tenant databases using Tenant property...
}
new InitialRelationshipCreator(context).Create();
new InitialClinicCreator(context).Create();
new InitialAppointmentCreator(context).Create();
context.SaveChanges();
}
Hello i set the default culture to ar to the page should render from rtl but when i load the page for the first time it render from ltr so i must refresh the page to take effect and render from rtl as expected i made sure the cookies of Abp.Localization.CultureName have the value ar what i miss here ?