转换对象以进行SQL更新/插入 [英] Converting Object for SQL Update/Insert

查看:107
本文介绍了转换对象以进行SQL更新/插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为mssql插入/更新转换对象的最佳方法是什么。基本上,我有一个映射到对象的XML文档。字段名称几乎相同,我使用的任何其他属性都是mod。目前,我使用反射生成sql
语句。我是C#的新手(来自php),我知道还有其他方法。我正在调查Linq,但忽略了它,因为这是一个长期的项目并关注它的未来。还看了Entity,但是没有足够的exp。


如果我必须迭代每个参数并匹配插入的sql列,那么使用反射似乎是性能损失。有没有更好的办法?需要一个对象并将其转换为sql可以使用的东西吗?


Sql数据适配器? Linq(真的不想使用linq)


数据的大小相当大, 来自XML对象中的20-50个字段,以及100-3000行的任何字段。这将在夜间重复说,20-50次。因此存在一些性能问题。


下一个问题是这些XML文档中的一些是多级的。

解决方案

< blockquote>

您好


转到XML论坛以获得更好的支持。


感谢您的理解。


What is the best method for converting object for a mssql insert/update. Basically, I have an XML doc mapped to an object. The field names are pretty much the same, anything else I used attributes to mod. Currently, I am using reflection to generate sql statements. I am pretty new to C# (coming from php), I know there has got to be other ways. I was looking into Linq, but disregarded it as this is a long term projec and concerned for its future. Also looked at Entity, but not enough exp.

Using reflection, seems like a performance hit, if I have to iterate over every parameter and match to the sql columns for the insert. Is there a better way? Something that takes an object and converts it to something sql can use?

Sql data adapter? Linq (really do not want to use linq though)

The size of the data is fairly hefty,  from 20-50 fields in the XML Object and anywhere from 100-3000 rows. This would be repeated nightly say, 20-50 times. So there is some performance concerns.

The next problem is that some of these XML documents are multilevel.

解决方案

Hi

Move to XML forum for better support.

Thanks for your understanding.


这篇关于转换对象以进行SQL更新/插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆