简单的CRUD生成器 [英] Simple CRUD Generator for C#

查看:156
本文介绍了简单的CRUD生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个简单的CRUD(或DAL)生成器为C#。我不想要任何重量级,因为我只有几个表在SQL Server 2008数据库。

I am looking for a simple CRUD (or DAL) Generator for C#. I don't want anything heavyweight since I only have a couple of tables in a SQL Server 2008 database.

有任何建议吗?我知道.netTiers,但对我需要的太多了。

Any suggestions? I know .netTiers, but it is way too much for what I need.

谢谢!

我尝试了LINQ to SQL,它不能很好地满足我的需要。

UPDATE: I tried LINQ to SQL and it doesn't work well for my needs.

推荐答案

我使用SubSonic过去的项目,轻便且易于使用。

I have used SubSonic on past projects, it's lightweight and easy to use.

他们提供了一个简单的教程视频,它应该不会超过10分钟,以完全设置。我建议观看视频的下一半处理Web应用程序项目,因为它显示了如何创建一个自定义的Visual Studio按钮,为您创建DAL,当您点击它,而不是使用自定义构建提供程序,因为他们建议

They offer a simple tutorial video and it should take no more than 10 minutes to get it completely setup. I recommend watching the second half of the video that deals with Web Application Projects because it shows you how to create a customized Visual Studio button that creates the DAL for you whenever you click on it instead of using a custom build-provider as they suggest in first half of the video.

它提供了几种方法来访问您的数据,Active Record,生成类型化的存储过程和视图,或您可以使用的查询语言

It offers several ways to access your data, Active Record, generating typed stored-procedures and views, or a query language that you can use.

使用后,我发现了一些怪癖:

After using it, I have found a few quirks:


  • 如果使用一个没有参数的生成的存储过程,它会抛出一个 NullReferenceException 。解决方法是创建在过程中未使用的哑元参数

  • DeepSave()函数在当你使用一个代码(例如 Where(Tag.Columns.TagName).IsEqualTo()时,你必须从连接表中单独保存数据

  • < subjective)
    ,请确保使用字符串值 Tag.Columns.TagName 引用列 - 否则将抛出异常尝试使用 Column.Schema
  • If you use a generated stored-procedure that does not have a parameter, it will throw a NullReferenceException. A workaround is to create a dummy parameter that isn't used in the procedure
  • The DeepSave() function does not work in the current 2.1 version, you'll have to individually save data from joined tables
  • When you use a coditional (e.g. Where(Tag.Columns.TagName).IsEqualTo("subjective"), make sure you use the string value Tag.Columns.TagName to reference the column - otherwise an exception will be thrown if you try to use the Column.Schema

这篇关于简单的CRUD生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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