Currently it is really slow using:
public void Save(ISagaEntity saga)
{
SessionFactory.GetCurrentSession().Save(saga);
}
I did however try with reading from the queue adding to a list<ISagaEntity>
and then looping through that with a StatelessSession and a transaction
doing Session.Insert(entity). It did make a difference but not that much. Is
there anything else I can specify like disabling autoflush?
On Thu, Sep 10, 2009 at 4:51 PM, Tuna Toksoz <[email protected]> wrote:
> and the code where you save?
>
> Tuna Toksöz
> Eternal sunshine of the open source mind.
>
> http://devlicio.us/blogs/tuna_toksoz
> http://tunatoksoz.com
> http://twitter.com/tehlike
>
>
>
>
> On Thu, Sep 10, 2009 at 10:47 AM, Mikael Henriksson
> <[email protected]>wrote:
>
>> Sure thing I'll start with the *entity:*
>> public class SagaEntity : ISagaEntity
>> {
>> public virtual Guid Id { get; set; }
>> public virtual Guid CorrelationId { get; set; }
>> }
>>
>> *Mapping:*
>> public class SagaEntityMap : ClassMap<SagaEntity>
>> {
>> public SagaEntityMap()
>> {
>> Table("saga");
>> Id(x => x.Id).Column("saga_id").GeneratedBy.Assigned();
>> Map(x => x.CorrelationId).Column("correlation_id").Not.Nullable();
>> }
>> }
>>
>> *Configuration:*
>> public FluentConfiguration GetFluentConfiguration()
>> {
>> return Fluently.Configure().Database(
>> MsSqlConfiguration.MsSql2008.ConnectionString(
>> x =>
>> x.Is(ConfigurationManager.ConnectionStrings["MessagingConnection"].ConnectionString))
>> .AdoNetBatchSize(100)
>> .CurrentSessionContext<ThreadStaticSessionContext>()
>> ).Mappings(m =>
>> m.FluentMappings.AddFromAssemblyOf<SagaEntityMap>()
>>
>> .Conventions.AddFromAssemblyOf<EnumAsIntegerConvention>()
>> .ExportTo(@"D:\Projects\NHibernate
>> Mappings"));
>> }
>>
>> I have tried using stateless session and looping with insert like Ayende
>> suggested. I am using NServiceBus and MSMQ to send receive messages with
>> btw.
>>
>> On Thu, Sep 10, 2009 at 3:53 PM, Tuna Toksoz <[email protected]> wrote:
>>
>>> Can you show a piece of code?
>>>
>>> Tuna Toksöz
>>> Eternal sunshine of the open source mind.
>>>
>>> http://devlicio.us/blogs/tuna_toksoz
>>> http://tunatoksoz.com
>>> http://twitter.com/tehlike
>>>
>>>
>>>
>>>
>>> On Thu, Sep 10, 2009 at 9:51 AM, Mikael Henriksson <[email protected]
>>> > wrote:
>>>
>>>> Id strategy is set to Assigned since I am using guid for id and I need
>>>> to assign it before it hits the database because it is queued before
>>>> handled
>>>> by nhibernate.
>>>>
>>>> On Thu, Sep 10, 2009 at 3:43 PM, Tuna Toksoz <[email protected]> wrote:
>>>>
>>>>> What is your id strategy?
>>>>>
>>>>> Tuna Toksöz
>>>>> Eternal sunshine of the open source mind.
>>>>>
>>>>> http://devlicio.us/blogs/tuna_toksoz
>>>>> http://tunatoksoz.com
>>>>> http://twitter.com/tehlike
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Sep 10, 2009 at 9:11 AM, Mikael Henriksson <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Is something wrong with the AdoNetBatchSize?
>>>>>> I can't get it to work. I would expect to get 100 inserts at a time if
>>>>>> I specify batch size 100 but nothing is happening.
>>>>>> Can I dump the xml configuration for nhibernate to disk? I know the
>>>>>> entities are dumpable but what about the nh config...
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---