CSLA Core .Net 3.8 Video Series Notes
Core3801 - Intro
00:00 Intro
00:46 CSLA .NET Developement Framework
01:40 Cost of developement & Maintenance
02:15 Buil-in support for growth
03:50 Abstract .NET
05:28 A brief history
07:29 CSLA .NET primary features
08:35 Data Binding
10:20 Validation Rules
11:29 Authorization Rules
12:16 N-Level Undo
14:49 LINQ
19:30 Mobile Objects
21:13 Abstract Persistence
24:43 Who uses CSLA .Net
27:23 Which version to use
31:03 N-Layer - CSLA Application Layer Model
31:50 Interface
32:18 Interface Control
33:11 Business Layer
34:51 Data Access / Data Storage
38:11 Application Architectures (Tiers)
39:37 Standalone Application
41:08 2-Tier Client/Server
42:30 3-Tier Client/Server
46:47 SOA "Edge" Application
48:40 Setting up your environment
50:39 Demo
50:42 Where to get framework (www.lhotka.net)
53:50 Where to put csla files and folder structure
57:15 How to build dlls
58:10 How to install snippets
59:30 Demo001 Simple solution
59:45 Library project
64:10 Properties
66:30 LibraryTests project
67:10 SampleItemTest.cs     - Tests
69:30 SampleItemTest.cs     - NewSampleItem meta state tests
71:48 SampleItemTest.cs   - IsNew & IsDirty
73:36 SampleItemTest.cs   - IsSaveable
74:21 SampleItemTest.cs     - GetSampleItem
75:30 Other Tests
80:47 MvcApp
82:15 WpfApp MVVM
85:05 Demo002 N-Tier solution (WcfPortal)
85:38 WcfAppServer
87:12 References
88:02 WpfApp (does not ref Library, instead app.config ref WcfPortal)
90:00 MvcApp (does not ref Library, instead web.config ref WcfPortal)
92:00 Brief Re-cap
92:45 Where to go for help
96:58 Summary
Core3802 - Business Object Types
00:00 Intro
00:55 CSLA Object Stereotypes
01:14    Editable Objects (single, list, root, parent, child)
05:45 Dynamic List Objects
07:15 ReadOnly Objects (single, list)
09:30 Name/Value List Objects
10:55 Command Objects
12:51 Criteria Objects
14:48 Object Factory Objects (create, fetch, update, delete, execute)
15:51 Other Common Types
16:20 POCO - Plain Old CLR Object
16:44 DTO - Data Transfer Object
18:07 Entity Object
18:55 Proxy Object
20:20 Typical Business Class
20:42 Properties
21:09 Business/Validation Rules
21:37 Authorization Rules
22:00 Factory Methods (asynchronous)
22:35 Data Access (optional)
23:29 Typical Object Factory Class (create, fetch, update, delete, execute)
24:14 DEMO003 - example of stereotype objects
25:43 Editable Object - (TestObject : BusinessBase)
28:06 using statements (Csla, Csla.Data, DataAnnotations)
29:06 [Serializable] class attribute
30:30 class declaration
33:15 Properties Region
33:20 PropertyInfo declaration
36:01 Public property (GetProperty, SetProperty)
41:26 DataAnnotation attributes (required, stringlength)
43:58 Private backing field example
46:49 [NonSerialized] attribute
48:45 Business Rules Region
49:25 AddBusinessRules method
50:02 Authorization Rules Region
50:15 AddObjectAuthorizationRules - per-type rules
50:55 AddAuthorizationRules - per-property rules
51:53 Factory Methods Region
52:30 private constructor and reason for factory methods
54:37 NewTestObject factory method
54:51 GetTestObject factory method
55:30 Data Access Region
55:59 DataPortal_Create
56:27 [RunLocal] attribute
56:49 refers briefly to DataPortal_Fetch, DataPortal_Insert, DataPortal_Update, DataPortal_DeleteSelf
58:10 Runs DEMO003 to show TestObject behaviour
61:50 EditableRootList Object - (Categories : BusinessListBase)
62:53 EditableChild Object - (CategoryEdit : BusinessBase)
63:43 EditableRootList Factory Method scoped as internal
64:20 EditableRootList DataPortal_Fetch
65:08 DataPortal_FetchChild
65:40 runs app to demo behaviour
66:44 DynamicCollection Object - (DynamicCategories : EditableRootListBase)
68:00 Specifically designed for windows forms datagrid control
68:15 Works with Silverlight datagrid control and several 3rd party WPF datagrid controls
68:20 Doesn't work with WPF Toolkit datagrid control
69:05 AddNewCore
71:10 AllowNew = true in constructor
72:25 Factory method - Get
72:33 DataPortal_Fetch
73:08 DynamicCollectionChild Object - (DynamicCategoryEdit : BusinessBase)
73:45 Factory method loads using parameter then calls MarkOld
74:00 Runs DEMO003WinForm app to show DynamicCollection behaviour
75:26 NameValueList Object - (CategoryList : NameValueListBase)
77:50 Runs DEMO003 to show CategoryList behaviour
79:28 ReadOnlyList Object - (ProductList : ReadOnlyListBase)
81:06 Factory methods  
81:10 DataPortal_Fetch
81:44 ReadOnly Object - (ProductInfo : ReadOnlyBase)
82:25 private set { LoadProperty(IdProperty, value); }
83:00 Talks about GetProperty, SetProperty, ReadProperty, LoadProperty
83:40 Internal factory method
84:00 Child_Fetch     
84:30 Runs DEMO003 to show ProductList behaviour
84:58 Command Object - (CheckProductId : CommandBase)
86:27 Constructor
86:35 Properties
86:58 DataPortal_Execute
87:52 BeginExecute
88:07 Example of a common hierarchy of objects
88:45 OrderEdit - BusinessBase Object
89:00 LineItems - BusinessListBase Object
91:25 LineItem - BusinessBase Object
92:17 Details - BusinessListBase Object
92:41 DetailEdit - BusinessBase Object
93:32 Runs DEMO003 to show Order behaviour
94:57 Summary
Core3803 - N-Tier Data Access
00:00 Intro
00:33 Data Access Overview
01:11 Business Object
01:44 Data Access Layer (DAL)
02:45 Data Access Invocation
03:26 Data Access Technologies Overview (Databases, Services, Files, More...)
05:15 Data Access Invocation Overview
05:46 Business class
08:48 Object factory class
10:06 DAL Location Overview
10:42 Business object contains DAL
12:09 Object factory is the DAL   
13:26 Business object invokes DAL
14:53 Object factory invokes DAL
17:16 Data Access Region
      DataPortal_Create
      DataPortal_Fetch
      DataPortal_Insert
      DataPortal_Update
      DataPortal_DeleteSelf
      DataPortal_Delete
      DataPortal_Execute
      Pre, Post and Exception methods
19:10 Object Factory Class
      Create
      Fetch
      Update
      Delete
      Execute
20:29 DEMO003 - (Business object contains DAL)
22:22 TestObject Class
23:00 Description of DataPortal
25:04 DataPortal_Fetch
27:14 ConnectionManager
30:17 GetManager
30:41 ConnectionStrings
31:30 ctx.Connection
31:45 Parameterized query
33:00 ExecuteReader
33:12 SafeDataReader
34:05 Allows you to use string tokens
34:32 BypassPropertyChecks
36:32 ValidationRules.CheckRules (optional - use if you do not trust data coming from database)
38:50 No try catch blocks so exceptions will flow back up to factory method then to UI
41:30 DataPortal_Create
44:05 call to base.DataPortal_Create
44:27 RunLocal attribute
45:39 DataPortal_Insert
46:33 SELECT SCOPE_IDENTITY
46:58 Transactional attribute
47:30 TransactionScope
47:50 EnterpriseServices (COM+)
48:32 Manual
50:17 DataPortal_Update
50:39 meta state automatically managed
51:31 DataPortal_DeleteSelf
52:00 OrderEdit Class
52:08 DataPortal_Fetch (parent and child data)
52:37 DataReader Read and NextResult
53:24 DataPortal.FetchChild    
53:30 LineItems Class ChildFetch
54:17 LineItemEdit Class ChildFetch
55:00 Details Class ChildFetch
55:44 DetailEdit Class ChildFetch
57:31 Summary
58:22 DEMO (from data subdirectory, shows how to use repository model - DpRespos)
58:43 Solution structure (WpfUI, Library, DataAccess, DataAccess.Ado, DataAccess.Mock)
59:58 TestObject Class
60:16 DataPortal_Fetch
60:27 DataAccess.DalFactory.GetManager
62:09 DataAccess.DalFactory Class
62:18 GetManager
62:27 ConfigurationManager.AppSettings["DalManagerType"]
62:46 App.config - <appSettings> (loads assembly by name)
63:49 Activator.CreateInstance
65:12 GetProvider
66:33 ITestObjectDal Interface (Fetch, Insert, Update, Delete)
68:52 DataAccess.Mock Fetch
69:12 ArrayDataReader
69:49 DataAccess.Ado Fetch
70:32 Library References DataAccess project only
71:50 Demo Summary
73:00 DEMO (Object data factory model)
73:52 Solution structure (WpfUI, Library, DataAccess, DataAccessAdo, DataAccessEf)
74:43 TestObject Class
74:50 Pro - No longer has a Data Access region in business class
75:10 Con - Breaks encapsulation
75:45 Con - DataPortal can no longer manage the business object metastate
76:10 Pro - more flexibility, better separation of concerns
76:23 ObjectFactory attribute
77:56 DataAccess.FactoryLoader
78:25 GetFactory, GetFactoryType
79:28 App.config - <appSettings> (loads assembly by name)
81:20 Discusses indirection of DataAccess layer
81:50 DataAccessAdo.TestObject.Fetch
83:05 Loading of business object properties
85:15 CheckRules
85:19 MarkOld
85:54 DataAccessEF.TestObject.Fetch
87:00 Data access layer creates business object and pushes values into it
89:29 EntityKeyDataProperty
90:14 TestObject EntityKeyData private property
90:50 DataAccessEF.TestObject.Update using EntityKeyData
      create object, set key, set entitykey, attach
92:24 DataAccessAdo.TestObject.Update
93:48 Demo Summary
95:05 Summary
Core3804 - Data Portal Configuration
00:00 Intro
00:33 N-Layer Architecture
01:25 Whither the Business Layer
03:19 Mobile Object Application
04:56 Data Portal Overview
06:45 Factory Pattern
07:12 static factory method in business class
07:55 separate factory object
09:35 Data Portal (distilled)
12:43 Data Portal as Channel Adapter
15:08 Channel Adapter
16:34 Local
18:59 WCF
21:07 Message Router
22:10 Transaction Routing
23:57 Demo
24:31 Demo004
26:35 Show Product List (async demo)
28:38 Product List Business Class (GetProductList, BeginGetProductList)
35:20 BeginFetch (update client side cache)
36:00 How to call sync and async fetch
38:20 AutoResetEvent(false), WaitOne(), Set()
43:23 SingleCriteria
46:32 RunLocal attribute
48:20 not available in Silverlight
49:05 DataPortal.ProxyModes.LocalOnly parameter for Silverlight
50:00 Client-side Configuration
51:13 App.config (appSettings - 2-tier, 3-tier)
55:50 Csla.DataPortalClient.WcfProxy configuration
              Endpoint Address, Binding (Synchronous), Contract
60:40 CustomWcfProxy (Subclass of Csla.DataPortalClient.WcfProxy)
62:15 Constructor - change name of endpoint
64:05 override GetProxy method (used to add security info)
65:00 override GetChannelFactory method (complete control of initialization on client side)
66:08 CslaAutoCloneOnUpdate
              location transparency for factory methods and data access methods
              set to false if corrupt object can be discarded
73:45 Application Server
77:00 WcfAppServer - Asp.Net project
77:45 References (copies dlls to bin folder)
78:21 Setting up a WCF Service
78:30 Svc file (ServiceHost Csla.Server.Hosts.WcfPortal)
80:30 Web.config configuration
80:45 system.serviceModel element to define server endpoint
82:10 behaviour returnFaults includeExceptionDetailInFaults
84:16 Sequence of events on application server for a request
86:40 CslaAuthorizationProvider
87:30 Custom Server Authorizer (ServerAuthorizer project)
              override Authorize method
90:10 Csla.Server.ObjectFactory attribute
91:35 Transactional attribute
92:12 DataPortal_OnDataPortalInvoke
93:10 DataPortal_OnDataPortalInvokeCompleted
93:39 DataPortal_OnDataPortalException (good place to log exceptions)
97:00 Caching (CatergoryList : NaveValueListBase)
99:30 Unit of Work (SampleUoW object to retrieve multiple objects in one round trip)
103:08 Demo of SampleUoW
103:52 Data Portal is not tied to CSLA
106:25 Silverlight requires iMobile Interface
106:39 inherit from Csla.Core.MobileObject
107:10 Demo of Non-CSLA Object
107:24 Exception Handling
             DataPortal Exception
              BusinessException
              BusinessObjectGraph available for debugging
              Entire stack trace is available (server side + client side)
112:20 Summary
Core3805 - Business and Validation Rules
00:00 Intro
00:34 Centralization of Business Rules
00:47 Data-centric worldview
01:52 Object-oriented worldview
03:54 Rules Subsystem
04:00 Common Rules
05:17 Custom Rules
05:52 Static bool methods
06:32 Async rule methods (only for validation)
08:23 Rule Severity
08:53 Error
09:38 Warning
09:39 Info
10:03 Priorities and Short-circuiting  
12:10 Manual option to short-circuit in rule
12:40 Caution: can't tell order that rules with same priority will run
13:03 Access Broken Rule Data
13:42 IDataErrorInfo
14:17 BrokenRulesCollection property
15:20 IsValid
16:07 IsSelfValid
16:39 Rule Metadata
17:00 ValidationRules.GetRuleDescriptions()
17:30 RuleDescription class
18:18 Demo005
18:56 Solution structure
19:22 Basic construction and use of business rules
19:40 Editable Object Level Rules
19:40 System.ComponentModel.DataAnnotations
20:45 [Required] attribute
21:10 List of available data annotations
21:40 Attributes used by CSLA, Silverlight data form, ASP.Net, MVC2
23:20 Overriding error message displayed to user with literal string or resource
24:20 [EndsWithNumber] custom validation attribute
25:25 EndsWithNumberAttribute inherits from ValidationAttribute
25:35 [AttributeUsage(AttributeTargets.Property)]
25:52 Constructors
25:56 default with default text
26:03 overload with text passed in
26:10 overload with error message accessor is passed in
26:27 IsValid override
26:55 .Net 3.5
27:29 Silverlight and .Net 4
30:42 Validation rule method (validation rule does not change the business object)
31:00 private static allows for strongly typed fields
33:35 ToUpper business rule (business rule changes the business object)
34:40 BypassPropertyChecks to avoid an infinite loop
36:40 Could use ToUpper() in property setter but not recommended
38:14 Synchronous rules
38:40 Asynchronous rule (not thread safe)
39:15 AsyncValidationRuleContext
40:40 context parameter (Rule does not have direct access to business object)
41:27 method not invoked on a background thread!
42:00 BeginExecute, ExecuteCompleted
44:00 context.OutArgs
45:20 context.Complete
46:30 Async rules can only be Validation Rules. They can never change the business object.
47:00 Csla.Validation.RuleSeverity Error, Warning, Information
48:27 context.OutArgs.Severity (Async rule)
48:40 e.Severity (Sync rule)
50:00 RuleArgs parameter
50:10 e.StopProcessing (short circuiting)
51:10 AddBusinessRules method
53:44 base.AddBusinessRules (associates data annotation attributes to properties and business rules)
54:55 ValidationRules.AddRule (associates a rule to a property)
56:49 Csla.Validation.CommonRules
58:35 Custom Reuseable Rule (non generic)
61:00 Rule Priorities
65:00 Short Circuiting (priorities <= 0 always run, priorities > 0 only run if all lower priority rules have passed)
66:07 ValidationRules.ProcessThroughPriority
67:22 ValidationRules.AddDependentProperty
71:00 Collection Level Rules
71:30 TotalAmount property on BusinessListBase
72:06 OnChildChanged override
72:30 there is no DataBinding to a property on a collection object
74:20 place TotalAmount property in parent BusinessBase object
75:23 ValidationRules.CheckRules
75:30 Explicitly raise OnPropertyChanged event
76:11 CalcTotal Rule
77:17 Invocation of Rules
77:39 SetProperty helper invokes business rules
78:00 DataPortal_Create default behaviour is to run the rules
79:26 DataPortal_Fetch can call ValidationRules.CheckRules if database not trusted
80:40 ValidationRules.CheckRules can check rules for a specified property
81:20 Consumption of Rules
83:00 The Rules API
84:20 Rule URI
85:30 GetRules method
86:20 Csla.Vsliedation.RuleDescription Class
88:25 BrokenRulesCollection
89:20 GetFirstMessage, Count, ErrorCount, WarningCount, InformationCount
90:10 example of a LINQ query against the BrokenRules collection
91:21 System.ComponentModel.IDataErrorInfo interface
94:30 IsValid
95:04 IsSelfValid
95:21 IsSavable
97:00 Multi-threading code to handle async rules in console or web application
98:10 Block UI thread using synchronization primative
98:25 var wait = new System.Threading.AutoResetEvent(false);
98:47 wait.WaitOne
99:00 ValidationComplete
99:31 wait.Set
100:50 Suppressing Rule Checking (block mode used for web, xml services)
101:00 BypassPropertyCheck
101:50 StartBatchUpdate, ValidationRules.SuppressRuleChecking, EndBatchUpdate
105:46 Summary
Core3806 - Authentication and Authorization
00:00 Intro
00:27 Authentication
01:42 Supported Techniques
01:52 Windows
02:40 MembershipProvider
04:08 Custom
05:00 CSLA .Net Types
05:05 ApplicationContext.User
07:30 BusinessPrincipleBase
07:38 CslaIdentity
07:50 CSLA .Net Pre-Built Types
08:00 MembershipIdentity
08:18 UnauthorizedPrincipal
08:18 UnauthenticatedIdentity
08:45 Authorization
09:30 Role-based model
10:00 Uses current Principal for IsInRole
10:12 Per-Type
10:40 Per-Property
11:01 CSLA .Net Controls
12:14 WPF
12:29 Windows Forms
14:15 Demo006
14:20 Solution structure
15:00 Demo UI overview
18:12 Authenticate method
18:20 Generic Principal
20:10 Csla.Security.UnauthenticatedPrincipal
22:00 Demo
22:30 Custom
23:34 Demo
25:10 Server User
26:00 CustomPrincipal Login method
34:00 Csla.ApplicationContext.User
38:06 CustomIdentity class
43:07 Configuration (App.config CslaAuthentication = "Csla")
44:15 Web.config (appSettings CslaAuthentication = "Csla")
45:58 Membership
46:50 Demo
48:10 MembershipLogin method
48:51 Csla.Security.MembershipIdentity.GetMembershipIdentity
49:20 MembershipIdentity class
51:10 Adding properties to an identity class
51:20 CslaIdentity class is not generic so explicit register property is required
54:02 Windows Authentication
54:40 App.config, Web.config CslaAuthentication = "Windows"
56:54 Web.config authentication mode="Windows"
57:19 identity impersonate="true"
58:56 AppDomain.CurrentDomain.SetPrincipalPolicy
59:10 System.Security.Principal.PrincipalPolicy.WindowsPrincipal
59:39 Demo
61:30 make background threads use the same principal as the foreground thread
61:35 AppDomain.CurrentDomain.SetThreadPrincipal(Csla.ApplicationContext.User)
63:49 Principal & Identity model
64:42 IsInRole method
66:41 CustomCheckRoles class
68:57 App.config CslaIsInRoleProvider = "Library.CustomCheckRoles,Library,IsInRole"
69:35 Authorization
70:29 AddObjectAuthorizationRules (per-type)
71:19 AllowCreate, AllowGet, AllowEdit, AllowDelete
72:00 CSLA default behaviour is permissive
74:34 AddAuthorizationRules (per-property)
74:56 AllowWrite, AllowRead
75:41 DenyWrite, DenyRead
76:48 AllowExecute
77:14 GetProperty, SetProperty helper methods
80:17 CanExecuteMethod
81:10 PrincipalPermission
83:07 override CanExecuteMethod, CanReadProperty, CanWriteProperty
85:16 Utilizing authorization information
86:05 ReadWriteAuthorization winforms control
88:05 Csla.Security.IAuthorizeReadWrite
90:45 Csla.Security.AuthorizationRules
90:45 CanCreateObject, CanGetObject, CanEditObject, CanDeleteObject
93:10 Summary