Hello Hikalkan
I am still trying to figure out how to do this, I found this article from Fabio Maulo but I can't figure how to implement this on your ABP framework. I am still very new to DI (using castle) and NHibernate.
If its not too much to ask, can you have a look e share some ideas ? [http://fabiomaulo.blogspot.com.br/2009/09/configure-sessionfactory-providers.html])
Thanks
Hello,
I think these topics will share some light to your need.
[http://forum.aspnetboilerplate.com/viewtopic.php?f=2&t=259])
[http://forum.aspnetboilerplate.com/viewtopic.php?f=2&t=232])
Ohhh, I missed that, now its working, thanks. Its weird because on the web site I don't have the "Copy always" option selected and works, anyway.
I changed the internal to public, now that you said I think Its wrong right ? :?
So, how should I use? property injection ?
Thanks
Ohh ok, thanks for the reply. :)
Hi, I am back trying to resolve my issue on this.
I want to make some changes so I can use that on NHibernate. I just need to make the changes you did on EntityFrameworkGenericRepositoryRegistrar on the NhRepositoryInstaller ?
thanks
Hi I think I got it too. Just to clear out.
So if I do like module zero, the audit log won't be saved automatically by abp Interceptor right?
Because class "AuditingInterceptor" and method "Intercept", will write the log like this:
SimpleLogAuditingStore.Save
Logger.Info(auditInfo.ToString());
So, my scenario will be this:
My log store
public class AuditingStore : IAuditingStore, ITransientDependency
{
private readonly IRepository<AuditLog, long> _auditLogRepository;
/// <summary>
/// Creates a new <see cref="AuditingStore"/>.
/// </summary>
public AuditingStore(IRepository<AuditLog, long> auditLogRepository)
{
_auditLogRepository = auditLogRepository;
}
public Task SaveAsync(AuditInfo auditInfo)
{
return _auditLogRepository.InsertAsync(AuditLog.CreateFromAuditInfo(auditInfo));
}
}
my app service
public class GerenciadorBoletadorService : IGerenciadorBoletadorService
{
private readonly IGerenciadorBoletadorRepository _gerenciadorBoletadorRepository;
private readonly IAuditingStore _auditStore;
public GerenciadorBoletadorService(IGerenciadorBoletadorRepository gerenciadorBoletadorRepository, IAuditingStore auditingStore)
{
_gerenciadorBoletadorRepository = gerenciadorBoletadorRepository;
_auditStore = auditingStore;
}
public List<TemplateObjeto> GetTemplateObjetos(int statusOperacaoId, int sistemaLegadoId, int perfilId)
{
List<TemplateObjeto> result = null;
try
{
result = _gerenciadorBoletadorRepository.GetTemplateObjetos(statusOperacaoId, sistemaLegadoId, perfilId);
_auditStore.SaveAsync(new AuditInfo());
}
catch (Exception ex)
{
throw ex;
}
return result;
}
}
Note: If done like that I can't use the audit attributes or interceptors.
Hi,
Yes, I saw those docs, but want to save on my database.
on Abp framework I saw 2 examples where it uses the AuditingStore.Save, but both is instances of "SimpleLogAuditingStore", that saves only on a .txt file right ? Its not clear to me how to use it.
If I create a custom class like on Abp.Zero "public class AuditingStore : IAuditingStore, ITransientDependency" how will I Fill my AuditInfo object ? when that save is called? I don't see that on abp.zero sample.
sorry for the trouble Thanks.
<cite>hikalkan: </cite> It saves audit logs automatically (see docs: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Audit-Logging">http://www.aspnetboilerplate.com/Pages/ ... it-Logging</a>).
Do you want that other class methods (than app service methods) write aufit logs. Document have a related section: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Audit-Logging#DocConfig">http://www.aspnetboilerplate.com/Pages/ ... #DocConfig</a>
Do you want to insert a log manually? Just inject and use IAuditingStore.
Hi
Nice, I will check this example from code project and come back here with an sample.
I am hosting on IIS.
On that example doesn't say nothing about windsors AddFacility<WcfFacility> I will need to change the framework to add that
Thanks
Yes, sorry about that. I found it, will post here the answer if somebody needs, or you can delete the thread.
Thanks
SET XACT_ABORT { ON | OFF }
<cite>hikalkan: </cite> Hi,
This is for EF, not NH.
Ohhh, :| thats ok. I will try to make one to work with NH following your help on my topic.
Thanks again.