Heyo,
I am trying to load our currency conversion rates into a cached
collection in NH.
We store every conversion rate at the start of every day, and use that
conversion group id in our currencies.
So I just setup the CurrencyConversionRate entity, and did a .ToList()
on it. It seemed to be working for a while, I guess, but now it takes
around 7 minutes to return to NH. Nothing major has changed.
Any idea why 1600 small rows would require 7 minutes of work?
The DB query takes 35 reads and 4ms duration.
I have tried some things, and currently my code looks like this:
public IList<CurrencyConversionRate> All()
{
var sf = ObjectFactory.GetInstance<ISessionFactory>();
using (IStatelessSession s = sf.OpenStatelessSession())
{
return s
.QueryOver<CurrencyConversionRate>()
.List();
}
}
public class CurrencyConversionRate : Entity
{
#region Natives
public virtual decimal Rate { get; set; }
public virtual CurrencyType BaseCurrency { get; set; }
public virtual CurrencyType TargetCurrency { get; set; }
public virtual DateTime CreatedOn { get; set; }
public virtual bool Enabled { get; set; }
public virtual int Group { get; set; }
#endregion
}
public class CurrencyConversionRateOverride :
IAutoMappingOverride<CurrencyConversionRate>
{
public void Override(AutoMapping<CurrencyConversionRate>
mapping)
{
mapping.Id(x => x.Id).Column("Id");
mapping.Map(x => x.BaseCurrency).Column("FromCurrencyID");
mapping.Map(x => x.CreatedOn).Column("DateCreated");
mapping.Map(x =>
x.Group).Column("CurrencyConverterRateGroupID");
mapping.Map(x => x.TargetCurrency).Column("ToCurrencyID");
mapping.Table("CurrencyConverterRates");
//mapping.Cache.ReadOnly().IncludeAll();
}
}
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.