Chapter 23 - Data access with NHibernate ready for review

33 views
Skip to first unread message

Jeffrey Palermo

unread,
Jan 5, 2010, 1:49:55 AM1/5/10
to mvc2inaction-discuss
I'd like to get this discussion list going my posting the first manuscript chapter we have ready.  It is the first chapter because it had the most reusable content from the 1st edition book.  The example was converted from using XML mapping files to FluentNHibernate code-based mappings.

The chapter uses Inversion of Control and constructor injection, but it does not use a container library.  It implements dependency injection and abstract factories through code.
Please reply to this group and tell us what you think.





Best regards,
Jeffrey Palermo
MVC2iA_CH_23.docx

rohancragg

unread,
Jan 5, 2010, 9:13:37 AM1/5/10
to mvc2inaction-discuss
It might be useful if in summary towards the end of the chapter, you
relate the various classes you've discussed to where they live in
physical packages and/or relate them to where they live inside the
Onion architecture; just to finally hammer home the point about how
the inner layers should not depend on outer ones.

I realise that you show this to some extent in the use of namespaces
and screen shots from Solution Explorer but in the code snippet from
the DataConfig class the namespace is omitted. I think that when we
read code samples we often skim the nameaspace and don't read it or at
least miss the subtleties of the inter-dependencies unless we have a
compiler or IDE to show us. Something visual that explicitly shows the
package layout or the classes super-imposed on the onion might be a
useful addition to the summary?

>  MVC2iA_CH_23.docx
> 727KViewDownload

Jeffrey Palermo

unread,
Jan 5, 2010, 9:34:30 AM1/5/10
to mvc2inaction-discuss
Thanks for the feedback!

Regards,
Jeffrey Palermo

Rong

unread,
Jan 5, 2010, 1:24:06 PM1/5/10
to mvc2inaction-discuss
Is this for a second Edition?

>  MVC2iA_CH_23.docx
> 727KViewDownload

Jeffrey Palermo

unread,
Jan 5, 2010, 2:19:52 PM1/5/10
to mvc2inaction-discuss
Yes.  The title of the book is "ASP.NET MVC 2 in Action".  It is a second edition to "ASP.NET MVC in Action" by Manning Publications:  http://manning.com/palermo

Best regards,
Jeffrey Palermo


--
--------------------
Please feel free to comment on the progress of the book, the content, and the code samples.  All code and text is available on the book's GitHub site at http://github.com/jeffreypalermo/mvc2inaction.  We hope developing this book out in the open and with your feedback makes it a great book for the community.


TJA

unread,
Jan 5, 2010, 5:38:32 PM1/5/10
to mvc2inaction-discuss
When it will be available on MEAP ?

Thanks

> > athttp://github.com/jeffreypalermo/mvc2inaction.  We hope developing this


> > book out in the open and with your feedback makes it a great book for the

> > community.- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

TJA

unread,
Jan 5, 2010, 6:15:23 PM1/5/10
to mvc2inaction-discuss
Page 7 at bottom it's written "When BuildFactory() is called..." you
mean CreateDefaultRepositoryBuilder().

Thanks

Thomas

> > - Afficher le texte des messages précédents -- Masquer le texte des messages précédents -

charliesolomon

unread,
Jan 13, 2010, 1:10:52 PM1/13/10
to mvc2inaction-discuss
I reviewed this during my plane trip to Austin for MVC bootcamp and
learned a lot! Sorry I don't have more substantial feedback... this
chapter looks great to me. Here are some minor corrections:

Page 1: Intro paragraph, last sentence: should be "applicable" not
"application"

Page 7: "To even the inexperienced eye" --> should it be "To even the
experienced eye"?

Page 11: "The two files" should be "The two XSD files"

Jeffrey Palermo

unread,
Jan 13, 2010, 1:22:13 PM1/13/10
to mvc2inaction-discuss
Glad you enjoyed it.  Thanks for the corrections!

Best regards,
Jeffrey Palermo


--
--------------------
Please feel free to comment on the progress of the book, the content, and the code samples.  All code and text is available on the book's GitHub site at http://github.com/jeffreypalermo/mvc2inaction.  We hope developing this book out in the open and with your feedback makes it a great book for the community.


Chris Benard

unread,
Jan 30, 2010, 2:33:46 PM1/30/10
to mvc2inaction-discuss
Hey Jeffrey,

This was quite an eye opener, since I've never used NHibernate and I'm
still wrapping my head around your Onion Architecture.

With that said, I offer the following suggestions for correction.
Also, here is a link to the docx which I marked up under review mode.
If you open the docx file, be sure to turn on the mode where it shows
the comments and tracked changes.

http://www.box.net/shared/m9rp03e2bi

1) Page 8: RepositoryBuilder appears to be a field, not a property as
stated.
2) Page 11: As another reviewer stated, I added XSD in between "two
files" to make "two XSD files".
3) Page 11: Listing 23.6: Table("Visitor") should be Table("Visitors")
as it appears everywhere else including the XML in the same code
listing.
4) Page 12: "The equivalent XML mapping is included in commented for
for reference." Remove duplicate "for" and replace "commented" with
"comments".
5) Page 13: Listing 23.7: In the "Return Fluently.Configure(...",
"Return" should have a lowercase "r" (in C#).
6) Page 17: Listing 23.11: In the When_saving_should_write_to_database
method, you create a Visitor object manually, but you have a
CreateVisitor(DateTime) method you use several other times in the same
TextFixture that does the exact same thing. Consider using that method
there instead of the manual creation, in observance of the DRY
principle.
7) Page 17: Listing 23.11: In the lines in that same Test, you do
comparisons like: Assert.That(loadedVisitor.Browser, Is.EqualTo
("1"));. However, it may more clear to do: Assert.That
(loadedVisitor.Browser, Is.EqualTo(visitor.Browser));. Again, you did
this in the other Tests in the same TextFixture.

Aside from those few things, I learned a lot! Like I said, I've never
used NHibernate, and it's neat to see how to hook it up, especially as
I'm beginning to understand and use the Onion Architecture.

I look forward to reviewing more chapters!

Thanks,
Chris Benard

On Jan 5, 12:49 am, Jeffrey Palermo <Jeff...@Palermo.cc> wrote:

>  MVC2iA_CH_23.docx
> 727KViewDownload

Jeffrey Palermo

unread,
Jan 31, 2010, 5:51:10 PM1/31/10
to mvc2inaction-discuss
Chris,
Thank you very much for the thoughtful comments.  I will be sure to work them in for the 2nd draft.

Best regards,
Jeffrey Palermo


Reply all
Reply to author
Forward
0 new messages