0

I recently posted a question regarding NHibernate. This lead me to check Codesmith's framework PLINQO for NHibernate.

At the same time, i was reading a tutorial on nhibernate at their official site (as i was looking at the generated project by PLINQO).

I am not an expert on NHibernate but what i am looking at right now (PLINQO Generated NHibernate project) looks to me very sloppy, pretty much a recipe for disaster. It creates a set of "Entities" that i am guessing is the business object? A big mess to my eyes.

Does anyone has experience with Codesmith's NHibernate?

Can anyone point me to a mc daddy of NHibernate. I have found so many variants so far that i am already overwhelmed with all this.

Thanks you.

Pepito Fernandez
  • 2,352
  • 6
  • 32
  • 47
  • i used NHibernate a lot and the generated stuff looks a lot like syntactic sugar for LinqToSql on top of NHibernate with best practices avoided and a lot of needless complexity. But honestly what is your real question? Me and "experience CodeSmith's NH"? : No – Firo Nov 14 '12 at 11:32
  • I've never used PLINQO but I just took a look at it and watched a few videos on it. It sounds like an interesting project but I personally wouldn't use it as I'm not a fan of code-generators to begin with. PLINQO is a wrapper around NHibernate so you give up a lot of the power of NHibernate when you use it but you gain code consistency, ease of use, and intelligent code generation capabilities. As far as using NHibernate, I personally use a mixture of the IRepository pattern and Fluent NHibernate for my mappings. – Randy Burden Nov 14 '12 at 23:53
  • @Firo, we try to reduce every complexity and focus on ease of use while following NHibernate best practices. – Blake Niemyjski Nov 15 '12 at 15:23
  • @RandyBurden I work for CodeSmith...Spot on with your comment above... Code Generation can be abused like everything else. We believe it should only be used when it's the right tool for the right job (And we'll tell our customers if there's something better).. – Blake Niemyjski Nov 15 '12 at 15:25

1 Answers1

0

I work for CodeSmith Tools. How do you feel the generated project looks sloppy? How would you improve it? We try to separate out the entities (POCOs) / hbm's for consistency and easy of use (as Randy detailed above). The Entities are generated directly from what is defined in the hbm file, which can be customized without losing your changes.

The generated project follows the architecture of Linq-to-SQL and Entity Framework. We feel this allows developers on the Microsoft Stack to switch between backends quickly (NHibernate to EF or EF to NHibernatE) while minimizing the amount of code changes. The generated datacontext manages the NHibernate sessions for you while giving you access to query extensions, caching and much more. Also, you don't lose any core NHibernate features as we just extend the core libraries. All of the core features are available on the DataContext under an advanced property.

P.S., The best place to post questions and get a timely response is via our forums.

Blake Niemyjski
  • 3,432
  • 3
  • 25
  • 41
  • IMO the learning curve for switching to NHibernate from EF and L2SQL is steep but you'll have to unlearn a lot of workarounds needed for L2SQL/EF. **1.** self implementing GUIDas entity? really? **2.** No Enums? **3.** no validation attributes on generated properties **4.** using database specific Quoting in mappings **5.** using NHibernate in POCOs ... and so on – Firo Nov 16 '12 at 10:02
  • 1
    I am sorry, maybe sloppy wasn't the right adjective. My bad. I just was expecting something different. But I must admit that for 5 years i have used your plinqo (linq to sql) and it fits my sql projects perfectly fine since linq to sql is a 1 to 1 mapping to the tables in the database. – Pepito Fernandez Nov 21 '12 at 06:12
  • That's what we like to hear :) – Blake Niemyjski Jan 09 '13 at 19:21