タグ

dbとmvcに関するlepton9のブックマーク (3)

  • MVCのモデルを分割する方法 - 浜村拓夫(・∀・)作品集

    MVCフレームワークでWebアプリケーションを作成するとき、肥大化していくモデルをどのように分割すれば良いのか?悩みます。 いつもは適当にやっているのですが、だんだんファイル数、クラス数、メソッド数が増えてくると、把握しづらくなって、辛くなってきますw 他の人のやり方を参考にして、モデルを適切に分割する方法を検討してみました。 ●Webアプリとは? Webアプリの特徴は、インターネットをはさんで、 (1) クライアント側 (2) サーバー側 に分かれていることです。 サーバー側は、 (a) DB(データを置いておく場所。通常はリレーショナルデータベース) (b) DBのラッパー(CRUDを担当するアプリケーション層) に分かれています。 で、このラッパー部分(b)に、MVCフレームワークを使っています。 (via もみじ饅頭(こしあん):もみじ饅頭のやまだ屋) MVCフレームワークは、 (

    MVCのモデルを分割する方法 - 浜村拓夫(・∀・)作品集
  • マジックビーンズ

    4. アクティブレコードとは データベーステーブルあるいはビューの1行が1つのクラスにラップさ れ、オブジェクトのインスタンスがそのデータベースの1つの行に結合 される。このクラスはデータベースアクセスのカプセル化も行う。オブ ジェクトの生成後は、保存メソッドで新しい行がデータベースに追加 される。 オブジェクトが更新されると、データベースの対応する行も また更新される。 出典: http://ja.wikipedia.org/wiki/Active_Record 5. アクティブレコードとは # 1 件取得 bug = Bug.find(1234) # SELECT * FROM bugs ! # 新規作成 bug = new Bug.new bug.summary = ‘保存時にクラッシュが発生’ bug.save # INSERT INTO bugs (summary) VALUES

    マジックビーンズ
  • Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10)

    In the previous tutorial you used inheritance to reduce redundant code in the Student and Instructor entity classes. In this tutorial you'll see some ways to use the repository and unit of work patterns for CRUD operations. As in the previous tutorial, in this one you'll change the way your code works with pages you already created rather than creating new pages. The Repository and Unit of Work Pa

    Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10)
  • 1