代码生成器与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
最满意答案
在Emacs中缺省处理这些“姐妹关键”的方式是将特殊键(如
tab
和return
)重定向到它们的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])
这不会影响
return
和tab
的处理,因为在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
, andreturn
) 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 changingC-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 remapC-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
andtab
sinceinput-decode-map
is applied beforefunction-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 forC-c C-i
which will now only work asC-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
, thentab
won't be useable to reach aC-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 normalC-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 你没有得到正确的。 ...
-
emacs24:ftp不起作用(emacs24: ftp doesn't work)[2023-11-18]
我已经在这种模式下解决了。 从这里下载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 ...