16
Introduction to CSLA.Net Keith Elder Microsoft MVP Blog: http://keithelder.net/blog/ Quicken Loans – http://www.quickenloans.com Every developer needs an easy button.

Introduction to CSLA.Net Keith Elder Microsoft MVP Blog: Quicken Loans – Every developer needs

Embed Size (px)

Citation preview

Page 1: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

Introduction to CSLA.Net

Keith ElderMicrosoft MVPBlog: http://keithelder.net/blog/Quicken Loans – http://www.quickenloans.com

Every developer needs an easy button.

Page 2: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

AgendaAgenda

Why CSLA.Net?What is CSLA.Net?

Out of OrderLogical and Physical ArchitectureScalableComponent

Features as a frameworkCSLA PrinciplesCSLA In Action

Code generation for CSLAValidationBinding

Page 3: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

WHY CSLA.NETWHY CSLA.NET

Page 4: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

No code consistency

Every team has their own internal

standards

Where does validation go?

Where do authorization

rules go?

Low Reusability

Can’t share

tools or libraries

New Developers

How to teach them

Lack of code templates

Can’t contribute right away

Adding a developer to a project can hurt

timeline

Why CSLA?

Page 5: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

WHAT IS CSLA.NETWHAT IS CSLA.NET

Page 6: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

A business object framework.

C

S

L

A

Component

Scalable

Logical

Architecture

Page 7: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

User Interface

Objects

Database

Logical And Physical Architecture

Three logical units that make up an application.

Objects

Database Interaction

Page 8: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

Three Tiered Deployment

User Interface

Logical And Physical Architecture

Objects

DatabaseInteraction

Single Tier (Fat Client / Mobile)

App Server

Redeploy Application

Web Deployment

Database

Object

Page 9: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

User Interface

Scalable

Objects

DatabaseInteraction

App Server

Objects

DatabaseInteraction

Objects

DatabaseInteraction

Objects

DatabaseInteraction

Database

s Cluster

Page 10: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

Component

Database InteractionData Portal Methods•Insert•Update•Select•Delete

Properties•LoanAmount•State•FICO•LoanType•Etc…

Validation•LoanAmount Is Required•State Is Required•FICO is Required•LoanType Is Required

Business Rules•FICO > 620 for LoanType•LoanType in this State•LoanAmount > 100,000

Loan Business Object

Security•Viewable By Banker•Viewable By Director•Employee Loan requiresspecial token in operations

Methods and Delegates•DoesClientQualify()•LoanAmountChanged•CreditScoreChanged

Generating the Component

Behavior Driven

Development

Focus on Business

Requirements

Page 11: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

Features of CSLA And CSLA Objects

Deployment

Build your application, decide how it is deployed later on

Binding

Automatically

supports data

binding for Winforms, Web, WPF

Other

Supports Workflow, WCF, and

Web Services

Internally

Mobile ObjectsBusiness logic and

data accessEasily

Generated

Unlimited Undos

Tracks broken business

rulesHas the object

changedBehavior Object-

Oriented Design

Nested Child Objects

Contact.Save();

Saves the contact and

all child objects like addresses,

notes, follow ups, loans,

etc.

Page 12: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

CSLA PRINCIPLESCSLA PRINCIPLES

Page 13: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

Base Classes

Editable Root

Editable Child

Editable, “switchable” (i.e., root or child)

Editable Root Collection

Editable Child Collection

Read-only

Read-only Collection

Command Object

Name Value List

Criteria Class

Holds information used to load the object

Nested within the business object

Can have multiple criteria classes for various purposes

Data Portal

Keeps track of where objects are instantiated,

as well as CRUD operations

Allows objects to move from client to app server

and back

Supports Remoting, Enterprise Services

(COM+), WCF and ASMX

CSLA Concepts

Page 14: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

IDENTIFYING YOUR OBJECT TYPES

IDENTIFYING YOUR OBJECT TYPES

Page 15: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

Loan Object Hierarchy

Root

Loan

Properties

FICO

LoanType

LoanAmount

Editable Child Objects

PrimaryBorrower

Editable Child Coll

Addresses

Editable Child

Address

CoBorrower

Editable Child Coll

Addresses

Editable Child

Address

Read Only

CreditReport

Red – CSLA TypeBlue – ClassGreen - Property

Let’s Go From Picture to Code

Page 16: Introduction to CSLA.Net Keith Elder Microsoft MVP Blog:  Quicken Loans –  Every developer needs

CSLA IN ACTIONDEMO

CSLA IN ACTIONDEMO

Code generation for CSLA

Validation

Binding