Glad you asked! :-)

Right now, I have an extension method over ISession and IStatelessSession. 
I have a BulkProvider abstract base class and classes such as 
SqlClientBulkProvider, OracleDataClientBulkProvider, etc. Each of these 
classes uses reflection to instantiate each provider's specific class 
(SqlBulkCopy, OracleBulkCopy, etc) in pretty much the same way as the 
Driver classes do, the only difference is that there is no base class in 
ADO.NET for bulk inserts (BTW, you might want to vote 
in 
https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3770804-create-base-class-dbbulkcopy-as-part-of-the-ado-ne).

What I still don't know is:

- Is the bulk provider going to be explicitly specified in the 
configuration or dynamically found?
- Conceptually, this only makes sense for IStatelessSession, but there is 
nothing preventing us to use it with ISession (like I am doing now)
- How to tell "client" id generators (guid, hilo, assigned, etc) from 
"server" ones other than explicitly looking for them - it doesn't make 
sense to use "server" ones
- Will it require changes in the API, like the one you suggested? I think 
it won't be required

The extension method is prototyped as:

public static void BulkInsert<T>(this ISession session, IEnumerable<T> 
entities);

But it will likely change.

What do you guys think?

RP


On Tuesday, August 26, 2014 10:22:30 PM UTC+1, Alexander Zaytsev wrote:
>
> Ricardo, how will the API look like? Now we have a single (actually there 
> are 2 of them) entry point for database calls: ISession 
> (IStatelessSession), so I propose to add a method to the IStatelessSession 
> interface.
>
> What do you think?
>
>
> 2014-08-26 23:17 GMT+12:00 Ricardo Peres <rjp...@gmail.com <javascript:>>:
>
>> Jeff,
>>
>> The native API handles transactions, see for example 
>> http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy(v=vs.110).aspx.
>>  
>> I'm talking of using NH as merely a wrapper over native APIs. If a driver 
>> cannot use the functionality, it would just throw an exception, like with 
>> multiqueries and futures. The advantages are huge performance gains when 
>> inserting large volumes of data, something that right now is not 
>> recommended with NH.
>> Anyway, I'll submit a pull request and I leave it to the community to 
>> decide its usefulness.
>>
>> RP
>>
>>
>> On Tuesday, August 26, 2014 12:06:36 PM UTC+1, Jeffrey Becker wrote:
>>>
>>> Not that I object to the feature but when I've tried to insert "too many 
>>> rows" with NHibernate, my performance problems were distinctly 
>>> application-layer.  Stuff grinds to a halt in NHibernate well before you 
>>> can get to the volume of data where you could have a measurable difference 
>>> with inserts, at least on MsSqlServer.  Also how do these operations deal 
>>> with transactions?
>>>
>>> On Monday, August 25, 2014 10:10:23 AM UTC-4, Ricardo Peres wrote:
>>>>
>>>> Hi,
>>>>
>>>> I created an issue for a new feature. This would allow NHibernate to 
>>>> perform bulk inserts, where the database providers support it.
>>>> Currently, SQL Server has SqlBulkCopy, Oracle OracleBulkCopy and MySQL 
>>>> has MySqlBulkLoaders, other may have similar APIs. The idea is to leverage 
>>>> these APIs to allow high-performance inserts.
>>>> Before you say "NHibernate is not an ETL tool", I know! :-) 
>>>> Nevertheless, I think such a functionality is useful - I have needed it in 
>>>> the past.
>>>> I have some code, which I'm in the process of cleaning up, and I will 
>>>> submit a pull request. Maybe version 5 can take it, what do you think?
>>>>
>>>> RP
>>>>
>>>  -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "nhibernate-development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to nhibernate-development+unsubscr...@googlegroups.com 
>> <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhibernate-development+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to