Base solution for your next web application

Activities of "nobruds"

Hello

I have a doubt, I think its related more about best practices or concepts.

On your samples I see that on Repository classes you use IQueryable<T>, so you can query over it. I am using "Session.QueryOver<T>()", that uses criteria right ?

Whats the best practice to use with your framework? the performance difference is little ?

Thanks for the help.

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.

Question

Hello,

I was looking into Module zero, to see how can I use auditing logs to insert info on my DB.

But if I follow that example, i wont be able to use the AuditingInterceptor class from Abp framework and AuditedAttribute right ? because wont save on DB

Or there's a way around that, instead I call the "AuditingStore.Save" on Intercept method, I call my db repository ?

Thanks

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

Hello hikalkan,

What is the proper way to use abp framework with a wcf service and consume it on a asp.net mvc application?

I did an example here but its wrong, I'm getting this error:

Component Abp.Domain.Uow.UnitOfWorkDefaultOptions could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.

I know this happens because of my code, because its registering on every method call. but how should I do it them, where I register my components ?

my code:

GerenciadorBoletadorWCF.svc
public class GerenciadorBoletadorWCF : IGerenciadorBoletadorWCF
    {
        public string GetNumeroBoleto()
        {
            IoContainer IoCDriver = new IoContainer();
            string NumeroBoleto = string.Empty;
            
            dynamic BoletoService = IoCDriver.GetInstance();

            NumeroBoleto = BoletoService.GetBoletoNumero();

            IoCDriver.Release(BoletoService);

            return NumeroBoleto;            
        }
    }

public class IoContainer
    {
        AbpBootstrapper bootstrapper;
        dynamic instance;

        public IoContainer()
        {
            bootstrapper = new AbpBootstrapper();            
            bootstrapper.Initialize();

            instance = bootstrapper.IocManager.Resolve<DependencyDriver>();             
        }

        public void Release(object obj)
        {
            bootstrapper.IocManager.Release(obj);
        }

        public dynamic GetInstance()
        {
            return instance.GetBoletoService();
        }
    }

class DependencyDriver : ITransientDependency
    {
        public readonly IBoletoNumeroService _boletoNumeroService;

        public DependencyDriver(IBoletoNumeroService boletoNumeroService)
        {
            _boletoNumeroService = boletoNumeroService;
        }

        public IBoletoNumeroService GetBoletoService()
        {
            return _boletoNumeroService;
        }
    }

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 }

Hello,

I'm not sure if this problem is from the abp but How can I execute a procedure with Liked server?

I'm getting the following error:

Unable to start a nested transaction for OLE DB provider "SQLNCLI10" for linked server "PINE_SQL". A nested transaction was required because the XACT_ABORT option was set to OFF. OLE DB provider "SQLNCLI10" for linked server "PINE_SQL" returned message "Cannot start more transactions on this session.".

My code on the Repository:

Session.CreateSQLQuery(
                    "EXEC BoletadorAtivos.dbo.blt_IntegracaoFuncaoCapitalGiroRegistro_sp @Operacao_ID = N'" + Operacao_ID + "'")
                    .ExecuteUpdate();

I just use the CreateSQLQuery from nhibernate.

My procedure tries to do an INSERT on another BD using Linked Server but fails, only SELECTS works with Linked Server.

Anybody has a clue why?

Thanks

<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.

Showing 21 to 30 of 40 entries