Component-based Scalable Logical Architecture

Last updated
Component-based Scalable Logical Architecture (CSLA)
Csla win8 full.png
Stable release
5.5.0 / 26 July 2021;12 months ago (2021-07-26) [1]
Repository CSLA Repo
Written in C#
Operating system Windows, macOS, Linux, iOS, Android
Platform .NET Core
Type Web application framework
License MIT License
Website www.cslanet.com

CSLA .NET is a software framework created by Rockford Lhotka that provides a standard way to create robust object oriented programs using business objects. Business objects are objects that abstract business entities in an object oriented program. Some examples of business entities include sales orders, employees, or invoices.

Contents

Although CSLA itself is free to download, the only documentation the creator provides are his books and videos, which are not free.

CSLA (Component-based Scalable Logical Architecture) was originally targeted toward Visual Basic 6 in the book Visual Basic 6.0 Business Objects by Lhotka. [2] With the advent of Microsoft .NET, CSLA was completely rewritten from the ground up, with no code carried forward, and called CSLA .NET. This revision took advantage of Web Services and the object oriented languages that came with Microsoft .NET (in particular, Visual Basic.NET and C#).

CSLA .NET was expounded in Expert C# Business Objects [3] and Expert One-on-One Visual Basic .NET Business Objects ISBN   1-59059-145-3, both written by Lhotka. Although CSLA and CSLA .NET were originally targeted toward Microsoft programming languages, most of the framework can be applied to most object oriented languages.

Current information about CSLA .NET is available through Lhotka's self-published Using CSLA 4 ebook series. [4]

Features of CSLA

Smart data

A business object encapsulates all the data and behavior (business logic and rules) associated with the object it represents. For example, an OrderEdit object will contain the data and business rule implementations necessary for the application to correctly allow the user to edit order information.

Rules engine

The CSLA .NET framework provides a rules engine that supports validation rules, business rules, and authorization rules. These rules are attached to object instances or properties, and are automatically invoked by CSLA .NET when necessary. Validation rules may be implemented using the CSLA .NET rule engine, or through the use of the DataAnnotations feature of Microsoft .NET.

Object persistence

Data creation, retrieval, updates, and deletes (CRUD) are performed by clearly defined methods of the business object associated with the data testing. Data access logic is clearly separated from business logic, typically using a repository pattern or other mainstream object-oriented programming techniques.

Metastate maintenance

CSLA .NET manages the metastate about each business object. For example, each business object tracks information about when it is new (it represents data that hasn't been saved yet) and when it is dirty (it needs to be saved to the database either because it is new or because its member data has been changed since it was last loaded). Business objects can also be marked for deletion so they can later be deleted (for example when a user has pressed a button confirming his or her intention to delete the rows.)

n-Level undo

This feature makes it possible for an object or collection of objects to maintain a collection of states. This allows the object to easily revert to previous states. This can be useful when a user wants to undo previous edits multiple times in an application. The feature can also allow a user to redo multiple edits that were previously undone.

This feature can provide rich functionality for desktop application and web applications. One note of caution would be to consider the overhead for high-transaction web-based applications. n-Level undo capability will require storing the previous state of an application generally accessed by reflection. This is common practice in desktop applications where changes must be "Applied". In web based designs, the added storage may pose unnecessary overhead as changes are generally submitted in batch and do not require the same level of "undo" capability.

Business rule tracking

Allows objects to maintain collections of "broken rule" objects. Broken rules will exist for an object until it is in a valid state, meaning it is ready to be persisted to the database. BrokenRule objects are usually associated with validation logic such as ensuring that no alphabetic characters are entered into a phone number field. For example, if an Account object has a PhoneNumber property, and that property is assigned a phone number with alphabetic characters, the Account object's IsValid property will become false (making it impossible to save to the database) and then a new BrokenRule object will be created and assigned to the Account's Broken Rules collection. The rule will disappear when the invalid phone number is corrected making the Account object capable of saving itself to the database.

Extended features of CSLA

Simple UI creation

Business objects created using CSLA .NET fully support data binding for all Microsoft .NET UI technologies, including Windows Runtime (WinRT), WPF, Web Forms, ASP.NET MVC, Windows Phone, Silverlight, and Windows Forms. Data-bound controls like DataGrids and ListBoxes can be bound to business objects instead of more generalized database objects like ADO.NET DataSets and DataTables.

Distributed data access

The CSLA .NET framework implements a concept called mobile objects or mobile agents to allow objects to move across network boundaries using WCF, Web Services, or other technologies. As a result, the data access enjoys location transparency, meaning that the logic may run on the client workstation or server depending on the application's configuration. It can also be configured to use manual database transactions or distributed two-phase commit transactions.

Data access logic is cleanly separated from business logic, and can be implemented using any data access technology available on the Microsoft .NET platform. Examples include ADO.NET Entity Framework, raw ADO.NET, nHibernate, etc.

Web Services support

Business logic created with the CSLA .NET framework can easily be exposed as a web service to remote consumers. This can be done using server-side Microsoft .NET technologies such as Web API, WCF, and asmx web services.

Related Research Articles

Microsoft Access Database manager part of the Microsoft Office package

Microsoft Access is a database management system (DBMS) from Microsoft that combines the relational Access Database Engine (ACE) with a graphical user interface and software-development tools. It is a member of the Microsoft 365 suite of applications, included in the Professional and higher editions or sold separately.

VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It allows Microsoft Windows system administrators to generate powerful tools for managing computers with error handling, subroutines, and other advanced programming constructs. It can give the user complete control over many aspects of their computing environment.

Visual Basic for Applications (VBA) is an implementation of Microsoft's Event-Driven Programming language Visual Basic 6.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no longer supported or updated by Microsoft, the VBA implementation in Office continues to be updated to support new Office features. VBA is used for professional and end-user development due to its perceived ease-of-use, Office's vast installed userbase, and extensive legacy in business.

In computing, Microsoft's ActiveX Data Objects (ADO) comprises a set of Component Object Model (COM) objects for accessing data sources. A part of MDAC, it provides a middleware layer between programming languages and OLE DB. ADO allows a developer to write programs that access data without knowing how the database is implemented; developers must be aware of the database for connection only. No knowledge of SQL is required to access a database when using ADO, although one can use ADO to execute SQL commands directly.

Visual Basic .NET Object-oriented computer programming language

Visual Basic, originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language, the last version of which was Visual Basic 6.0. Although the ".NET" portion of the name was dropped in 2005, this article uses "Visual Basic [.NET]" to refer to all Visual Basic languages released since 2002, in order to distinguish between them and the classic Visual Basic. Along with C# and F#, it is one of the three main languages targeting the .NET ecosystem. As of March 11, 2020, Microsoft announced that evolution of the VB.NET language has concluded.

The Visual Component Library (VCL) is a visual component-based object-oriented framework for developing the user interface of Microsoft Windows applications. It is written in Object Pascal.

ADO.NET is a data access technology from the Microsoft .NET Framework that provides communication between relational and non-relational systems through a common set of components. ADO.NET is a set of computer software components that programmers can use to access data and data services from a database. It is a part of the base class library that is included with the Microsoft .NET Framework. It is commonly used by programmers to access and modify data stored in relational database systems, though it can also access data in non-relational data sources. ADO.NET is sometimes considered an evolution of ActiveX Data Objects (ADO) technology, but was changed so extensively that it can be considered an entirely new product.

A business object is an entity within a multitiered software application that works in conjunction with the data access and business logic layers to transport data.

Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0 in 2006. WPF uses DirectX and attempts to provide a consistent programming model for building applications. It separates the user interface from business logic, and resembles similar XML-oriented object models, such as those implemented in XUL and SVG.

Windows Workflow Foundation Microsoft technology

Windows Workflow Foundation (WF) is a Microsoft technology that provides an API, an in-process workflow engine, and a rehostable designer to implement long-running processes as workflows within .NET applications. The latest version of WF was released as part of the .NET Framework version 4.5 and is referred to as (WF45).

The Anemic domain model is a programming Anti-pattern where the domain objects contain little or no business logic like validations, calculations, rules, and so forth. The business logic is thus baked into the architecture of the program itself, making refactoring and maintenance more difficult and time-consuming.

C# and Visual Basic .NET are the two primary languages used to program on the .NET Framework.

A Windows Script File (WSF) is a file type used by the Microsoft Windows Script Host. It allows mixing the scripting languages JScript and VBScript within a single file, or other scripting languages such as Perl, Object REXX, Python, or Kixtart if installed by the user. These types of scripts may also be used to link many other external scripts together using a src parameter on the <script> tag in a manner similar to HTML. Windows Script Files have the extension ".WSF". A WSF makes reference to each script module in a very basic XML hierarchy as shown below, adhering to those standards outside the <script> tags. Literal use of "</script>" or "<script>" inside your <script> tags and similar challenges can be handled by the use of CDATA, as shown within the examples.

Visual Basic (classic) Event-driven programming language

The original Visual Basic is a third-generation event-driven programming language from Microsoft known for its Component Object Model (COM) programming model first released in 1991 and declared legacy during 2008. Microsoft intended Visual Basic to be relatively easy to learn and use. Visual Basic was derived from BASIC and enables the rapid application development (RAD) of graphical user interface (GUI) applications, access to databases using Data Access Objects, Remote Data Objects, or ActiveX Data Objects, and creation of ActiveX controls and objects.

Entity Framework (EF) is an open source object–relational mapping (ORM) framework for ADO.NET. It was originally shipped as an integral part of .NET Framework. Starting with Entity Framework version 6, it has been delivered separately from the .NET Framework.

Microsoft Visual Studio Code editor and IDE

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs, as well as websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

Domain-driven design (DDD) is a software design approach focusing on modelling software to match a domain according to input from that domain's experts.

Windows Runtime (WinRT) is a platform-agnostic component and application architecture first introduced in Windows 8 and Windows Server 2012 in 2012. It is implemented in C++ and officially supports development in C++, Rust/WinRT, Python/WinRT, JavaScript-TypeScript, and the managed code languages C# and Visual Basic .NET (VB.NET).

Visual Basic .NET was released by Microsoft in 2002 as a successor to the original Visual Basic computer programming language. It was implemented on the .NET Framework 1.0. The main new feature was managed code. Programmers familiar only with Visual Basic would probably have encountered difficulties working with the new version or adapting existing programs for it.

ASP.NET Web Forms is a web application framework and one of several programming models supported by the Microsoft ASP.NET technology. Web Forms applications can be written in any programming language which supports the Common Language Runtime, such as C# or Visual Basic. The main building blocks of Web Forms pages are server controls, which are reusable components responsible for rendering HTML markup and responding to events. A technique called view state is used to persist the state of server controls between normally stateless HTTP requests.

References

  1. "Releases · MarimerLLC/csla". github.com. Retrieved 2021-07-26.
  2. Visual Basic 6.0 Business Objects ISBN   1-86100-107-X
  3. Expert C# Business Objects ISBN   1-59059-344-8
  4. Using CSLA 4 ( "Using CSLA 4 Ebook Series | CSLA .NET Store > Store". Archived from the original on 2013-03-11. Retrieved 2013-02-23.)