首页 \ 问答 \ 代码生成器与ORM(Code generator vs ORM)

代码生成器与ORM(Code generator vs ORM)

我编写了一个代码生成器,用于为给定的SQL Server / CE数据库生成POCO和存储库。 没有什么奇特的,只有简单的使用经典的ADO.Net的CRUD程序。 我的问题是,为什么我应该在自定义代码生成器上使用像L2S / EF4这样的ORM? 每隔两三年,微软就会推出一些新的数据访问框架/技术,而且我知道很多开发人员并不总是能够接触到最新的技术,但他们都知道经典的ADO.Net,如何修改现有代码以及如何开发新功能。 ORM工具是否带来了现在必须的东西,或者我可以坚持使用经典的ADO.Net?

谢谢!


I wrote a code generator which generates POCOs and repositories for a given SQL Server/CE database. Nothing fancy, only simple CRUD procedures using classic ADO.Net. My question is, why should I use an ORM like L2S/EF4 over custom code generator? Every 2 or 3 years Microsoft ships some new data access framework/technology and I know quite a few developers who can't always be in touch with the latest technologies, but every one of them knows the classic ADO.Net, how to modify the existing code and how to develop a new functionalities. Do ORM tools bring something which is a must nowdays, or I can stick with a classic ADO.Net?

Thank you!


原文:https://stackoverflow.com/questions/4788248
更新时间:2023-12-07 09:12

最满意答案

在Emacs中缺省处理这些“姐妹关键”的方式是将特殊键(如tabreturn )重定向到它们的ASCII等价物,然后仅将键绑定添加到ASCII版本。 因此,您可以使用类似的方式轻松地为非ASCII版本添加新的含义

(global-set-key [return] 'my-new-command)

但在你的情况下,你想要做的倒退就是在改变Cm同时让return行为像以前一样。 我能想到的最可靠的方法就是这样做(从大多数主要/次要模式绑定的角度来看,它是可靠的),可以将Cm早期无条件地重新映射到一些新事件,如下所示:

(define-key input-decode-map [?\C-m] [C-m])
(define-key input-decode-map [?\C-i] [C-i])

这不会影响returntab的处理,因为在function-key-map之前应用了input-decode-map function-key-map ,即在这些键变成ASCII控制键之前。 所以你可以这样做:

(global-set-key [C-m] 'my-new-command)
(global-set-key [C-i] 'my-newer-command)

缺点是这不仅适用于对Ci绑定,而且也适用于对Cc Ci绑定,现在只能用作Cc TAB (有时会很好,但偶尔可能会减少助记符)。

另一个缺点是,如果有一个tab绑定,那么tab将无法用于达到一个Ci绑定。 但是我们可以通过添加以下内容来解决这两个问题:

(define-key function-key-map [C-i] [?\C-i])
(define-key function-key-map [C-m] [?\C-m])

这会在没有使用新事件的绑定的情况下将新的Ci事件转换回正常的Ci


The way these "sister keys" are handled by default in Emacs is to redirect (via function-key-map) the special keys (like tab, and return) to their ASCII equivalent, and then only add key-bindings to the ASCII version. So you can easily add new meanings to the non-ASCII version with something like

(global-set-key [return] 'my-new-command)

but in your case you want to do the reverse which is to let return behave as before while changing C-m. The most reliable way I can think of to do that (reliable in the sense that it should work with most major/minor modes bindings) is to remap C-m early and unconditionally to some new event, as in:

(define-key input-decode-map [?\C-m] [C-m])
(define-key input-decode-map [?\C-i] [C-i])

this will not affect the handling of return and tab since input-decode-map is applied before function-key-map, i.e. before those keys are turned into ASCII control keys. So you can then do:

(global-set-key [C-m] 'my-new-command)
(global-set-key [C-i] 'my-newer-command)

A downside is that this will not only apply to bindings for C-i but also to bindings for C-c C-i which will now only work as C-c TAB (which will sometimes be just fine, but might occasionally be less mnemonic).

Another downside is that if there is a binding for tab, then tab won't be useable to reach a C-i binding. But we can fix those two problems by adding the following:

(define-key function-key-map [C-i] [?\C-i])
(define-key function-key-map [C-m] [?\C-m])

which will turn the new C-i event back into a normal C-i in case where there is no binding that uses the new event.

相关问答

更多
  • 怎么启动emacs[2022-10-26]

    你是在windows中还是linux中? windows有一个启动的图标 估计你问的是在linux中。打开终端,输入emacs能够打开X-emacs,就是带图形界面的emacs,输入emacs -nw能够打开文本模式下的emacs
  • Emacs 24具有内置主题,它不使用像(require 'color-theme)类的语句。 正如德鲁在评论中指出的那样,色彩主题和定制主题之间存在差异 ,而新的方向则是针对后者。 试试Mx customize-themes来看看。 从.emacs,你可以做一些事情,例如(load-theme 'wombat t) 。 但是 ...... 它可能仍然会出错。 有一件事可以把它搞乱,就是改变面貌 - 也许在你的.emacs文件的custom-set-faces部分。 Emacs的交互式自定义功能会自动包含您 ...
  • 在Emacs中缺省处理这些“姐妹关键”的方式是将特殊键(如tab和return )重定向到它们的ASCII等价物,然后仅将键绑定添加到ASCII版本。 因此,您可以使用类似的方式轻松地为非ASCII版本添加新的含义 (global-set-key [return] 'my-new-command) 但在你的情况下,你想要做的倒退就是在改变Cm同时让return行为像以前一样。 我能想到的最可靠的方法就是这样做(从大多数主要/次要模式绑定的角度来看,它是可靠的),可以将Cm早期无条件地重新映射到一些新事件, ...
  • 选项'选项 - >活动区域高亮'设置? 你可能想要设置 (transient-mark-mode t) 在~/.emacs或其他init文件中也是如此。 Is the option 'Options->Active Region Highlighting' set? You may want to set (transient-mark-mode t) in ~/.emacs or other init files as well.
  • 您可以为您的字体指定antialias=none选项,如GNU Emacs手册中所述 You can specify the antialias=none option for your fonts, as stated in GNU Emacs Manual
  • 你确定你使用了正确的'emacsclient'二进制文件吗? 您需要/Applications/Emacs.app/Contents/MacOS/bin/emacsclient ,并且默认情况下它不会在您的路径中。 如果您只是从命令行调用一个裸emacsclient ,您将从Apple提供的Emacs 22.1获得emacsclient 。 如果你运行emacsclient --version并得到这个: $ emacsclient --version emacsclient 22.1 你没有得到正确的。 ...
  • 我已经在这种模式下解决了。 从这里下载emacs-24.1xxxxxx.tar.gz http://alpha.gnu.org/gnu/emacs/pretest/ sudo apt-get install xorg-dev libjpeg-dev libpng-dev libgif-dev libtiff-dev libncurses-dev tar xvf emacs-24.1xxxxxxx.tar.gz cd /emacs-24.1xxxxxxx 。/配置 使 -----------我在/ SRC / ...
  • 变量term-unbind-key-list仅影响键映射term-raw-map绑定。 你可以通过查看函数multi-term-keystroke-setup的文档来找到它(不知道为什么这个信息不适用于变量本身......) 按键设置`term-char-mode'。 默认情况下, term-char-mode' conflict with user's keystroke. So this function unbinds some keys with的键绑定term-char-mode' conflic ...
  • 那么让我们填写tripleee指出的评论的相关部分: 造成问题的另一个原因是关键序列表示法的矢量符号:而不是[(control,)]和[(control')],你应该写[(control?,)]和[(control?')],这将起作用在老Emacsen也。 So let's fill in the relevant part of the comment pointed at by tripleee: Another cause of trouble is vector notation for key s ...
  • 似乎问题只发生在Gentoo上。 因为系统更新清除了一些字体。 解决方案是安装丢失的字体: emerge media-fonts/font-adobe-75dpi x11-apps/bdftopcf media-fonts/font-alias media-fonts/font-util 注销并重新登录后,我可以再次使用输入法。 It seems the problem only happen on Gentoo. Because system update clear up some fonts. The ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)