Вопрос

I'm working with a solution in which a http handler receives chunks of XML. These chunks should be parsed and mapped into a SQL Server database model.

I've seen some solutions where the parsing is done via stored procedures. To me it seems like a better solution to parse it in the application layer and then insert it to the db.

What would be the pros and cons with these two approaches?

Should I do the parsing in the handler or should this be done asynchronously?

Это было полезно?

Решение

You can create do it by few ways.

1) (I'd prefer it) Create C# parser and load data to database using bulk insert (http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx). Sample here http://www.codeproject.com/KB/database/SqlBulkCopy.aspx . The main advantage of this approach is full management of loading.

2) SQL Server Integration Services. The main advantage is its speed.

You should think what do you want to achive. If you need to load it really fast, you should use SSIS, if you need perfect flexibility and advanced features use C# approach.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top