Presented in partnership with Sponsors An Introduction to Castle - - PowerPoint PPT Presentation

presented in partnership with sponsors
SMART_READER_LITE
LIVE PREVIEW

Presented in partnership with Sponsors An Introduction to Castle - - PowerPoint PPT Presentation

Presented in partnership with Sponsors An Introduction to Castle ActiveRecord, or Stop Writing CRUD! Writing CRUD sucks! Every day, you are challenged to get more done in less time. You want to focus on real business value and stop being a


slide-1
SLIDE 1

Presented in partnership with

slide-2
SLIDE 2

Sponsors

slide-3
SLIDE 3

An Introduction to Castle ActiveRecord, or Stop Writing CRUD!

slide-4
SLIDE 4

Writing CRUD sucks!

slide-5
SLIDE 5

Every day, you are challenged to get more done in less time.

slide-6
SLIDE 6

You want to focus on real business value and stop being a plumber.

slide-7
SLIDE 7

In the end, it’s about having more time to do what’s really important.

slide-8
SLIDE 8

What is the Castle Project?

MonoRail ActiveRecord MicroKernel Windsor

slide-9
SLIDE 9

What is Castle ActiveRecord?

Castle ActiveRecord is an implementation

  • f the ActiveRecord

pattern for .NET implemented using Nhibernate.

slide-10
SLIDE 10

The Pattern

“An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic

  • n that data.”
slide-11
SLIDE 11

Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

What is Nhibernate?

slide-12
SLIDE 12

Code Walkthrough – The Old Way

slide-13
SLIDE 13

The ActiveRecord Way

  • Very little configuration
  • Extend from a base class

– ActiveRecordBase<T> – ActiveRecordValidationBase<T>

  • Attributes

– [ActiveRecord] – [PrimaryKey] – [Property] – [HasMany] – [BelongsTo]

slide-14
SLIDE 14

Code Walkthrough – ActiveRecord

slide-15
SLIDE 15

Things to think about

  • Text columns
  • Lazy Loading
  • Web apps require “isWeb=true”
  • ActiveWriter
slide-16
SLIDE 16

ActiveWriter

  • Drag & drop design surface
  • 1-way generation

– Partial classes

slide-17
SLIDE 17

Lazy Loading

ActiveRecord supports lazy loading BUT You should check this link out http://is.gd/71h

slide-18
SLIDE 18

Pros and Cons

  • Pros

– Simple, yet powerful – NHibernate behind the scenes and readily available when more power is needed

  • Cons

– Not a good fit for complex schemas or for batch

  • perations.
slide-19
SLIDE 19

Contacting me

  • My Blog: http://mjeaton.net
  • Email: mjeaton@gmail.com
  • Twitter: http://twitter.com/mjeaton
slide-20
SLIDE 20

References

  • The Castle Project

– http://castleproject.org

  • Martin Fowler’s ‘Patterns of Enterprise

Application Architecture’

– http://www.martinfowler.com/eaaCatalog/

  • NHibernate

– http://www.hibernate.org

slide-21
SLIDE 21