ASP.NET MVC 论坛应用程序

发布于 2024-08-09 19:17:53 字数 217 浏览 6 评论 0原文

我需要为朋友的网站编写一个论坛应用程序。我想用 C# 3.0 针对 ASP.NET MVC 框架和 SQL Server 数据库编写它。

所以,我有两个问题:

  • 我应该使用 Linq to SQL 还是实体框架作为数据库抽象?
  • 我应该使用 ASP.NET Membership API 还是添加 Users 表并自己实现?

谢谢。

I need to write a forum application for a friend's web site. I want to write it in C# 3.0 against the ASP.NET MVC framework, with SQL Server database.

So, I've two questions:

  • Should I use Linq to SQL or the Entity Framework as a database abstraction?
  • Should I use the ASP.NET Membership API or add Users table and implement it myself?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

极度宠爱 2024-08-16 19:17:54
  1. 互联网上有很多将 ling 与 ASP.NET MVC 结合使用的示例。但也许你可以添加你的 NHibernate 列表。如果您不想添加,我建议使用实体框架。使用 ORM 是一个优点。
  2. 我总是选择编写自己的会员管理层。如果您是这样的人(编写您自己的代码,并在将来进行更改时感到高兴。)编写您自己的成员资格层。如果您正在寻找快速解决方案,ASP.NET Membership API 是一个不错的选择。
  1. There are lots of examples around internet which is using ling with ASP.NET MVC. But may be you can add your list NHibernate. If you do not want to add i suggest Entity Framework. Using ORM's is a plus.
  2. I always chose write my own membership management layer. If you are a person like (write your own code and be happy when you are making changes in future.) write your own membership layer. If you are looking for a quick solution ASP.NET Membership API is a good choice.
橘亓 2024-08-16 19:17:54
  1. 实体框架肯定是——见下文。
  2. ASP.net 会员 API——易于维护。

原因:
实体框架与 LINQ to SQL

  1. Entity Framework definitely -- see below.
  2. ASP.net Membership API -- easy to maintain.

Reason:
Entity Framework vs LINQ to SQL

再可℃爱ぅ一点好了 2024-08-16 19:17:54

1)两者都怎么样?只需创建一个抽象,您就可以使用其中一个。我的建议是使用存储库模式。

2) 会员提供商有其优点和缺点。对于某些项目来说,它对于我的需求来说太复杂了。然而,如果您需要在短时间内运行某些东西,那么这是很好的选择。

1) How about both? Just create an abstraction and you could just use either. My recommendation is to use the repository pattern.

2) The membership provider has its strengths and weaknesses. For some projects, it was far too complex for my needs. However, it is great if you need to get something running in a short amount of time.

紫瑟鸿黎 2024-08-16 19:17:54

我不会回答第一个问题,因为我是 nhibernate 的粉丝
对于第二个问题,添加用户表并自己实现会员资格,我认为您至少无法以正确的方式做到这一点(很多人试图制作自己的会员资格 API,但他们搞砸了!)

I won't answer the first question since i'm a fan of nhibernate
for the second question adding a users table and implement membership yourself i don't think you will be able to do it at least the right way (lot of people tried to make their own membership api but they messed up !)

尝蛊 2024-08-16 19:17:54

1)完全取决于事情将变得多么复杂。如果您想要一个或多或少以 1:1 方式镜像您的表的快速 DAL,请选择 L2S(或者 SubSonic,如果您想要更成熟和受支持的东西)。如果您想要更多的 n 层类型的东西,其中您的表和域模型完全不同,请选择像实体框架这样的 OR/M(或者 NHibernate,如果您想要在各个方面都更好的东西)

2) ASP.net 成员资格极其复杂,其中有些部分的设计相当糟糕。然而,这取决于你对这些事情有多少经验。如果您足够了解如何采取措施避免会话固定攻击,请自行实施,因为它很可能比罐装解决方案更好。如果您不知道那是什么,请花点时间学习默认的。

1) Totally depends on how complex things are going to get. If you want a quick DAL that more or less mirrors your tables in a 1:1 fashion, go for L2S (or SubSonic if you want something more mature and supported). If you are going for more of an n-tier type thing where your tables and domain model are completely different, go for an OR/M like Entity Framework (or NHibernate if you want something that is pretty much better in every way)

2) ASP.net Membership is extremely complex, and there are bits of it that are fairly poorly engineered. However, it depends on how much experience you have with these things. If you enough to know how to take steps to avoid session fixation attacks, just roll your own because chances are it will be better then the canned solution. If you have no idea what that is, take the time to learn the default one.

剩余の解释 2024-08-16 19:17:54

需要考虑的是,SubSonic 3 是一个非常强大的数据访问生成工具。据我了解,它基本上将 Linq to Sql 包装在一些非常有用的包装器中,并使 Linq 的使用更加直观。使用 SubSonic 时,您可以立即构建一个非常强大的应用程序。但有一个小问题,如果您使用共享主机(例如 GoDaddy),您将遇到中等信任问题。在这种情况下,您始终可以回退到 Linq To Sql,而无需对代码库进行大量更改。

至于Aspnet_Membership。就其提供的工具数量而言,我建议使用它。

祝你好运,希望这会有所帮助。

Something to think about, SubSonic 3 is a pretty powerful data access generation tool. From what I understand, it basically wraps Linq to Sql inside of some very useful wrappers and makes using Linq a little more intutive. You can have a pretty powerful application built up in no time flat when using SubSonic. One little issue though, if you're using a shared hosting (say GoDaddy) you'll run into a medium trust issue. In that case you can always fall back to Linq To Sql without making many changes to your code base.

As for Aspnet_Membership. Just for the amount of tools it provides, I'd reccomend using it.

Good luck, and hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文