另一个数据访问层(c#.net 2.0)
意识到我正在编写另一个代码生成器来为简单的 ORM 层执行 sps/类/接口等。 这次大部分内容都在 SQL 中。 我有一个通用的 C# DAL,用于调用 sps/获取结果等(花了我一个小时左右,而且很小)。
我想现在肯定会有一个更简单的方法......是吗?
我对 SQL 充满信心/有能力,并使用存储过程等 - 我不想躲避 SQL,只是将填充/持久对象的编码中的无聊重复去掉。 我不喜欢学习模板语言/复杂的应用程序,或者生成大型臃肿软件(或构建在臃肿的 MS 库上)的应用程序。 还必须能够从现有数据库开始。
仍然是自己卷的情况吗? 真的吗?
.Net 2.0(Winforms)
编辑: 我并不完全反对模板,如果它真的很简单/快速上手的话。 理想情况下,该解决方案应该是小型的、免费的并且对其他开发人员来说并不可怕。
Realised I am writing yet another code generator to do the sps/classes/interfaces etc for a simple ORM layer. This time most of the guts are in SQL. I have a general-purpose C# DAL for calling sps/getting results etc. (took me all of an hour or so and is tiny).
I thought for sure there'd be an easier way by now... is there?
I am confident/competent with SQL and use stored procs etc - I'm not looking to hide from SQL, just take the boring repetition out of coding for populating/persisting objects. I'm not into learning a templating language/complex app, or apps that produce mega-bloatware (or build on bloaty MS libraries). Also must be able to start with an existing database.
Is it still a case of roll-your-own? Really?
.Net 2.0 (Winforms)
EDIT:
I am not entirely anti-template, if it's really simple/quick to pick up.
Ideally, the solution would be small, free and unscary to other developers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看一下 BLToolkit:
Take a look at BLToolkit:
不直接回答你的问题。
阅读 Ayende 的这篇精彩文章: 不编写自己的对象关系的 25 个原因Mapper
推荐使用NHibernate。
Not directly answering you question so.
Read this great post by Ayende: 25 Reasons Not To Write Your Own Object Relational Mapper
A recommend using NHibernate.
看看亚音速。
Take a look at SubSonic.
我喜欢nHibernate,我对SQL非常精通; 然而,我喜欢不必为每个表编写至少四个过程。 对于我不知道如何让 nHibernate 做的事情。
您确实有很多代码生成器,但如果您不想学习如何构建模板,并且对构建/社区模板不满意,那么您唯一的其他选择就是推出自己的模板。
I like nHibernate, I am very proficient in SQL; however, I like not having to write a minimum of four procs for each table. For things which I can't figure out how to make nHibernate do.
You do have a lot of code generators out there but if you don't want to learn how to build a template, and aren't satisfied with the built / community templates then your only other option would be roll your own.