开发者

What is the preferred method of building extremely lightweight business object / DAL now that I have finished a simple database?

I have completed a simple database for a project. Only 6tables. Of the 6, one is a "lookup" table.

There is one "master" table that is the driver for the system. It is referenced as a foreign key by the other four tables.

Give that this step is completed. What is the FASTEST, EASIEST way to create POCOs/BizObjects that can load load the data and the child data.

Here are my CAVEATS.

  • I don't want to spend more than 30-60 minutes learning how?
  • There is very little biz logic needed in the POCOs. They will pretty much load data. Don't even really need to write back data.
  • I already know CSLA (up to version 3) but I feel that is overkill for this little project.
  • Nevertheless, I would love it if it ROOT objects could have collection classes that contain the CHILD objects as in CSLA...but again, without using CSLA.
  • Please give the answer for .NET 35 but also if I was restricted to only use .NET 20.
  • Ideally I could just point a t开发者_运维百科ool at the database and the POCOs would be genn'ed.
  • FREE

Just curious what you guys use for this kind of scenario.

I understand that this question is subjective but I want to hear a variety of answers.

Seth


My choice would be linq-to-sql using sqlmetal to generate the code from the database.

Sqlmetal is a command line tool that generates classes for the database without customization. The advantage compared to the linq-to-sql designer is that you can easily rerun the tool to regenerate the classes if you have any changes to the database. Using the designer there is always a risk that the code isn't updated to match the database.


Use an ORM like nHibernate, SubSonic, Linq to SQL or Entity Framework.

They will all generate classes for you and a data layer.

The fastest to get up and running would be Linq to SQL, as it is built into VS 2008 (point to a SQL server, drag and drop, magic!).link text


For .NET 3.5, LINQ-to-SQL; drag the tables onto a data-context, job done. Actually any ORM would probably do, but LINQ-to-SQL is a very quick way of getting the job done using just the MS tools and VS IDE.

They aren't "pure" POCO done this way (they have L2S attributes etc), but it is easy. You can do pure POCO with L2S, but it takes a bit more effort.

With 2.0, NHibernate. But more work as unless you use additional tooling you'll have to write the classes and/or mapping files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜