您当前使用什么来访问数据?
您使用什么特定方法/应用程序在应用程序和数据库之间进行通信? 带有存储过程的自定义代码? 亚音速? 休眠? 实体框架? LINQ?
What particular method/application are you using to communicate between your application and a database? Custom code with stored procedures? SubSonic? nHibernate? Entity Framework? LINQ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
我想这让我变得老派。
I guess that makes me oldschool.
MVC 框架,其中模型具有使用实际数据库语言的数据源类,开发人员在大多数情况下使用 save、saveField、delete、find 等方法,框架将其转换为 sql 查询。 这不仅更安全、更简单,而且非常方便,因为代码与数据源无关,即您可以更改数据库服务器并保留代码。
MVC framework where model's has datasource classes with the actual database language, the developer in most cases uses save, saveField, delete, find etc methods and the framework translates this to sql queries. This is not only safer and easier, it is also very convenient in that the code is datasource indepenedent, ie you can change database server and keep the code.
我在工作场所的 Java 项目上开始使用 Hibernate,然后意识到存在 .Net 端口 (NHibernate),并在 .Net 项目中再次使用它。 我还发现了 joesteele 提到的文章,并将其用作我的项目的基础,并在需要时进行一些小的修改,主要是在需要手动启动和结束事务时。
相同的实践和库可以应用于 Java 和 C# 平台,以 Windows 或 Linux 作为应用程序平台,使得在不同平台上进行开发比需要学习不同的框架更容易。
虽然我计划研究 Subsonic、iBatis 和 LINQ,但目前 Hibernate 和 NHibernate 似乎是完成这项工作的正确工具,而我必须同时针对 Windows 和 Linux 平台。
I've started with Hibernate on Java project at my workplace, and then realized that there exist the .Net port (NHibernate) and used it again in a .Net project. I've also came across the article that joesteele mentions, and used it as a base for my projects with some minor modifications when needed, mostly when needed to target transaction beginning and ending manually.
The same practice and library that can be applied to both Java and C# platforms, targeting the Windows, or Linux as application platforms, makes development on different platforms easier than needing to learn different frameworks.
Although i'm planning to exmine the Subsonic, iBatis and LINQ, for now Hibernate and NHibernate seem like the right tool for the job while i have to target both Windows and Linux platforms.
我们有一个 Oracle 后端,其中包含 500 个存储过程,应用程序直接针对数据运行。
我开始构建一个自定义或映射的域模型,我一直在集成它,但我最初做错了,现在也陷入了处理这个令人头痛的问题......呃
We've got an oracle back end with something like 500 stored procedures where applications run directly against the data.
I started building a custom or-mapped domain model that I've been integrating but I did it wrong initially and now am stuck dealing with that headache as well...ugh
SubSonic 和 LINQ to SQL,但希望有一天 LINQ to SubSonic 能够出现!
SubSonic and LINQ to SQL, hopefully one day soon LINQ to SubSonic though!
在工作中,我们的代码库是 C++ 和 Perl,我们与 MySQL 数据库进行交互。 对于我们的界面,我们有一些相当薄的自定义类,围绕着 C++ 代码的基本 MySQL 客户端库和 Perl 脚本的 DBI 模块。
At work our code base is C++ and Perl and we talk to a MySQL database. For our interface we have some fairly thin custom classes wrapped around the basic MySQL client libraries for our C++ code and the DBI module for our Perl scripts.
我们在项目中使用 IdeaBlade。 我发现它非常容易使用。
We're using IdeaBlade on our projects. I've found it to be pretty easy to use.
我在之前的工作中使用 Hibernate 连接到 MySql 和 Sql Server,但后来我切换到了 .NET,所以目前我使用 LINQ,而且我真的很喜欢它。
I used Hibernate in my previous job to connect to both MySql and Sql Server but I have since switched over to .NET so currently I work with LINQ and I really enjoy it.
我主要使用 Microsoft Enterprise Library Data Access Block 来访问存储过程MS SQL Server 数据库。
I primarily use Microsoft Enterprise Library Data Access Block to access stored procedures in MS SQL Server databases.
我在过去一年左右的时间里一直在使用 NHibernate,事实证明它是一种(几乎)免费获得基本 CRUD 的非常快速的方法。
如果您想了解这一点,我可以推荐 Billy McCafferty 在 CodeProject 上发表的 NHibernate 最佳实践文章:
http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
这已被证明是一个出色的可扩展且灵活的解决方案,并且可以轻松实现 DAL 与 DAL 的明确分离其他层。
I've been using NHibernate for the last year or so, and it's proved to be a really quick way of getting basic CRUD (almost) for free.
If this is something you're looking to get into, I can recommend Billy McCafferty's NHibernate best practices article on CodeProject:
http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
This has proven to be a great scalable and flexible solution and makes it easy to achieve a clear separation of the DAL from the other layers.
我通常使用 LiNQ 创建 DataTier。
它由实现复合接口的存储库组成,因此我在如何使用它们方面具有完全的灵活性。
它们大多以域对象为中心,因此它们发出域对象并自行处理所有映射逻辑。
他们还可能创建一些列表字典,例如由一个人的 ID 和姓名组成的字典,因此我不必从数据库中提取太多内容来显示下拉列表。
尽管有时,对于较小的项目,我只使用属性基本映射而不使用 .dbml。
我觉得这种方法提供了一个非常干净的应用程序模型,因为所有杂乱的以数据为中心的逻辑都隐藏在 DataTier 中。 业务/服务层是纯粹的业务:)
I usually create a DataTier with LiNQ.
It consist of repositories that implement composite interfaces, so I have total flexibility on how to use them.
They are mostly domain object centric, so they emit domain objects and take care of all the mapping logic themselves.
They might also create some list dictionaries, f.ex a dictionary consisting of the id and name of a person, so I don't have to pull up too much from the db to display a drop down list.
Although sometimes, for smaller projects, I just use Attribute base mapping without a .dbml.
I feel that this approach gives a very clean application model, because all the messy data centric logic is hidden in the DataTier. The Business-/ServiceTier is pure business :)
我主要在工作和业余项目中使用 NHibernate。 一开始是为了尝试打破工作中使用 ADO.NET 数据读取器/数据集的规范,现在我们有一些使用 Hibernate/NHibernate 的项目。
I primarily use NHibernate, both at work and on my freetime projects. This started as an attempt to break out of the norm at work to use ADO.NET datareaders/datasets and we now have a few projects using Hibernate/NHibernate.
来自旧版本 MS Enterprise App Blocks 的 SqlHelper 类。 它远非完美,但对于简单的 CRUD 应用程序来说,其简单性是无与伦比的。
SqlHelper class from the older version of the MS Enterprise App Blocks. It is far from perfect, but hard to beat its simplicity for simple CRUD apps.
MS SQL 存储过程。
MS SQL Stored Procedures.