ASP.NET MVC - 数据库的替代品

发布于 2024-11-14 10:19:21 字数 1067 浏览 2 评论 0原文

我想过把这个问题分开,但我认为把它作为一个大问题更好。就这样吧。 :-)

警告:这个问题很深入。 :-)

我使用 ASP.NET 已经有一段时间了。就在几天前,在观看 Pluralsight 上的 MVC 课程后,我决定尝试一下它出来了。开发过程非常令人惊奇且非常简单,尤其是使用 Entity Framework 4.1。当我搜索部署选项时,我发现了 AppHarbor。不幸的是,我遇到了一些问题。看,我不能只是用 AppHarbor 所需的 git commit 神奇地移植我的数据库。问题是,我从来没有真正使用过数据库 - 它们总是只是工作

  1. 它不起作用 - MVC/EntityFramwork/Whatever-Is-Automagically-Working-Behind-The-Scenes 没有启动新数据库或任何
  2. AppHarbor 只允许 1 个数据库(免费版本)

潜在的解决方案?

  1. 合并数据库。我不知道如何做到这一点,也不知道如何保持 EntityFramework 的 Auto-Magic 工作。
  2. 对帖子/评论采用非数据库解决方案。我意识到数据库的效率非常高,因为文字文件和访问它的程序之间存在某种接口,因此您不需要文件锁定之类的东西。那么最好的选择是什么?

我的问题

处理这种情况的最佳方法是什么?不仅仅是这种特殊情况,而是“crap-i-hate-databases”的一般情况?

回答方式:

  1. 建议我学习数据库:可以,但是请提供一些好的资源。
  2. 提供非数据库替代方案:太棒了。
  3. 解释一下我需要做什么才能让这一切在 AppHarbor(但更普遍的是任何部署服务器)上运行:理想。我什至可以设立赏金来奖励它,

非常感谢;我意识到这是一个深刻的问题,获得的代表可能不值得。如果我需要提供更多信息,请告诉我。

I thought about splitting this up, but i think it's better as one big question. Here it goes. :-)

Warning: this question is in-depth. :-)

I've been working with ASP.NET for a little while now. Just a few days ago, after watching a course on MVC at Pluralsight, i decided to try it out. Development was amazing and very easy, especially with the Entity Framework 4.1. As i searched around for deployment options, i found AppHarbor. Unfortunately, i ran into some problems. See, i can't just magically port my databases over with the git commit AppHarbor requires. The problem is, I've never really worked with databases - they've always just worked automagically. I'm scared stiff of connection strings and the like. I managed to get a database set up on AppHarbor for the ASP.NET Membership stuff (I still need to figure out how to copy over the data and schemas, but i'll figure that out :-)) but i'm clueless on what to do about the Entity Framework SQL Server Compact database, which i'm using to store blog posts and comments. Problems:

  1. It's not working - MVC/EntityFramwork/Whatever-Is-Automagically-Working-Behind-The-Scenes isn't firing up a new database or whatever
  2. AppHarbor only allows 1 database (for the free version)

Potential Solutions?

  1. Combine the databases. I have no idea how to do this or how i would keep the EntityFramework's Auto-Magic working.
  2. Adopt a non-database solution for the posts/comments. I realize databases are incredibly more efficient as there's a sort of interface between the literal file and the programs accesing it, so you don't have file locking and stuff. So what would be the best alternative?

My Question

What's the best way to handle this situation? Not just this particular situation, but the general situation of "crap-i-hate-databases"?

Ways to answer:

  1. Recommending that i learn about databases: fine, but please provide some good resources.
  2. Giving a non-database alternative: awesome.
  3. Explaining what i need to do to get this all working on AppHarbor (but more generally any deploy server): ideal. I may even set up a bounty just to award it

Thanks so much in advance; I realize this is a deepish question and the rep garnered may not be worth it. Please let me know if i need to provide any more information.

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

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

发布评论

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

评论(3

ぶ宁プ宁ぶ 2024-11-21 10:19:21

我反对这种做法,建议您不要使用 EF 并使用 MVC3 生成一大堆脚手架代码。简化您的应用程序并真正了解正在发生的事情。这样您就可以调试和添加功能。

尝试使用现有数据库并使用 Massive< 构建 MVC3 应用程序/a>.非常简单且易于面对。当您看到它是多么容易时,您就会克服数据库恐惧症。

I am going against the grain and suggest you do not use EF and generate a whole bunch of scaffolding code using MVC3. Simplify your app and really learn what is going on. That way you will be able to debug and add features.

Try taking your existing database and building an MVC3 app with Massive. Really simple and confrontable.You will get over your database phobia when you see how easy it is.

孤寂小茶 2024-11-21 10:19:21

您可以考虑查看文档数据库,例如 Raven DB

You may consider checking out a document database like Raven DB.

我ぃ本無心為│何有愛 2024-11-21 10:19:21

我的建议是使用 Entity Framework 4.1 创建一些对象(称为代码优先),

Gu (Scott Guthrie) 有一些简单的演练,可以帮助您开始...并且您可以指向 Appharbor SQL 服务器地址

http://weblogs.asp.net/scottgu/archive/2011/03/19/rc-of-entity-framework-4-1-which-includes-ef-code-first.aspx< /a>
(最佳资源和其他资源的链接)
实际数据运行到数据库之前不应该超过半小时......

My suggestion is to Create some objects using Entity Framework 4.1 (called code first)

the Gu (Scott Guthrie) has some simple walkthroughs that will give you a start ... and instead of SQLCE4 you can point to the Appharbor SQL server address

http://weblogs.asp.net/scottgu/archive/2011/03/19/rc-of-entity-framework-4-1-which-includes-ef-code-first.aspx
(best resource and links to the others)
shouldnt be more than half an hour before you have real data running to a database...

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