I have a class TestRepository in which I want to get the localized string, but I get error >The name 'L' does not exist in the current context if I try
throw new UserFriendlyException(L("TestAlreadyExists"));
public class TestRepository : TestRepositoryBase<Test, int>, ITestRepository
I have a class which is having another class object as a member, When I call UpdateAsync it gives an error.
My question is why is it giving this error, its an update call not insert call so it should not give this error. ABC is a separate table.
Cannot insert explicit value for identity column in table 'ABC' when IDENTITY_INSERT is set to OFF.
public async Task UpdateTestsAsync(TestDto input)
{
var classobj = GetAll().Where(a => a.Id == input.Id).FirstOrDefault();
ObjectMapper.Map(input, classobj);
await UpdateAsync(classobj);
}
public class TestDto : FullAuditedEntityDto
{
public string TestName { get; set; }
public FetchABC abc { get; set; }
public int AbcId { get; set; }
public int Id { get; set; }
}
public class ABC : FullAuditedEntity
{
public virtual string TestName { get; set; }
public virtual ABC abc { get; set; }
public virtual int AbcId { get; set; }
}
So to make the above code working I'm doing
classobj.abc= null;
before
await UpdateAsync(classobj);
Is it good practice? Do you have any suggestions or better approach?
@alper @felixbeltran ,
Could you please explain how?
Finally I was able to find where to configure the "devtool" parameter and now rebuild time is really short.
Hi,
Why do We inherit from FullAuditedEntityDto? I don't see any use for this? because in the code mentioned I get CreationTime, CreatorUserId, DeleterUserId, DeletionTime, IsDeleted, LastModificationTime and LastModifierUserId columns proper values on edit, create and delete case if I use the same Dto for all action?
Please let me know what difference between a Dto inheriting from FullAuditedEntityDto and not inheriting from FullAuditedEntityDto . Could you please explain the difference between these two cases with some practical examples.
public async Task<int> CreateTest(TestDetailsDto input)
{
int TestId = await InsertAndGetIdAsync(ObjectMapper.Map<Test>(input));
return TestId;
}
public class Test : FullAuditedEntity
{
public const int NVarcharLength20 = 20;
public const int NVarcharLength30 = 30;
public const int NVarcharLength50 = 50;
[Required]
[MaxLength(NVarcharLength20)]
public virtual string TestCode { get; set; }
[Required]
[MaxLength(NVarcharLength30)]
public virtual string TestName { get; set; }
[MaxLength(NVarcharLength50)]
public virtual string TestDesc { get; set; }
}
[AutoMap(typeof(Test))]
public class TestUpdateDetailsDto
{
public string TestCode { get; set; }
public string TestName { get; set; }
public string TestDesc { get; set; }
public int Id { get; set; }
}
So You mean to say that there is no way around to make it faster?
Hi,
Every time I run npm start, it gets stucked on 92% chunk asset optimization. It takes 3-4 mins. Do we have any setting or configuration so that it won't take much time?
Hi @felixbeltran,
Could you please explain devtool configuration solution.
Thanks ,
My bad, I missed it.
Where should I add the code mentioned by you?
this._testService.createTest(this.test)
.subscribe(() => {
this.notify.info(this.l('SavedSuccessfully'));
this.modalSave.emit(this.test);
this.router.navigate(['/app/tests']);
});
public async Task CreateTest(TestInput input)
{
throw new UserFriendlyException("Test Code Already Exist");
}
I want to localize "Test Code Already Exist" message.
We have support for localized string only on the client side, But If I want to send some exception to the client side, there is no support for localization. Do You have any approach for this?