The L helper is not defined for repositories.
You can inject ILocalizationManager and define it:
private string L(string name)
{
return _localizationManager.GetString(AbpZeroTemplateConsts.LocalizationSourceName, name);
}
Concurrency control is usually about reading or writing the same record (Optimistic Locking: #4146@6c148c17-0f2f-42c9-a386-dd70810dd348).
In your case, you are inserting a new record. Can you show related code on how you determine and set the next "code"?
Looks like you need to implement a singleton lock.
The error messages are pretty clear.
MyAppRepositoryBase does not have a public default constructor and could not be instantiated. Constructor on MyAppRepositoryBase not found.
public class MyAppRepositoryBase<TEntity, TPrimaryKey> : EfCoreRepositoryBase<MyAppDbContext, TEntity, TPrimaryKey>
where TEntity : class, IEntity<TPrimaryKey>
{
public MyAppRepositoryBase(IDbContextProvider<MyAppDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
}
public class MyAppRepositoryBase<TEntity> : MyAppRepositoryBase<TEntity, int>
where TEntity : class, IEntity<int>
{
public MyAppRepositoryBase(IDbContextProvider<MyAppDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
}
As explained above, EntityFrameworkCore requires eager-loading.
Try this:
ProxyHelper.UnProxy(_announceRepository).As<EfRepositoryBase<MyProjectDbContext, AnnouncementEntity>>().Table.Attach(announce);
Add this using directive:
using Abp.Reflection;
Why not localize on server side?
throw new UserFriendlyException(L("Test Code Already Exist"));
You can override abp.message.error:
var error = abp && abp.message && abp.message.error;
if (error) {
abp.message.error = function (message, title) {
message = localize(message);
title = localize(title);
return error(message, title);
};
}
function localize(name) {
return "[" + name + "]";
}
Can you put a breakpoint and check the actual type of _announceRepository?
Is your DbContext actually called MyDbContext?