Component-based Scalable Logical Architecture: Difference between revisions

Content deleted Content added
m Disambiguating links to Object-orientation (link changed to Object-oriented programming) using DisamAssist.
 
(40 intermediate revisions by 25 users not shown)
Line 1:
{{Infobox Software
{{Unreferenced|date=July 2008}}
| name = Component-based Scalable Logical Architecture (CSLA)
'''Component-based Scalable Logical Architecture (CSLA)''' is a [[software framework]] created by [[Rockford Lhotka]] that provides a standard way to create robust [[object oriented]] programs using [[Business object (computer science)|business object]]s. Business objects are objects that abstract business entities in an object oriented program. Some examples of business entities include sales orders, employees, or invoices.
| logo = [[File:Csla win8 full.png|frameless]]
| caption =
| collapsible = yes
| developer =
| released =
| latest release version = <!-- If you update this, remember to also update [[Comparison of web application frameworks]]-->8.2.7
| latest release date = {{release date and age|2024|09|06|df=yes}}<ref name="csla_release">{{cite web
| url=https://github.com/MarimerLLC/csla/releases/
| title=Releases · MarimerLLC/csla
| website = github.com
| access-date=2024-12-03
}}</ref>
| latest preview version =
| latest preview date =
| operating system = [[Windows]], [[macOS]], [[Linux]], [[iOS]], [[Android (operating system)|Android]]
| platform = [[.NET Core]]
| language =
| license = [[MIT License]]
| genre = [[Web application framework]]
| website = {{URL|https://www.cslanet.com/}}
| repo = {{URL|https://github.com/MarimerLLC/csla|CSLA Repo}}
| programming language = [[C Sharp (programming language)|C#]]}}
 
'''Component-basedCSLA Scalable Logical Architecture (CSLA).NET''' is a [[software framework]] created by [[Rockford Lhotka]] that provides a standard way to create robust [[Object-oriented programming|object oriented]] programs using [[Business object (computer science)|business object]]s. Business objects are objects that abstract business entities in an object oriented program. Some examples of business entities include sales orders, employees, or invoices.
Although CSLA itself is free to download, the only documentation the creator provides are his books, which are not free.
 
Although CSLA itself is free to download, the only documentation the creator provides are his books and videos, which are not free.
CSLA was originally targeted toward [[Visual Basic]] 6 in the book ''Visual Basic 6.0 Business Objects'' by Lhotka ISBN 1-86100-107-X. With the advent of [[.NET Framework|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|Visual Basic.NET]] and [[C Sharp (programming language)|C#]]).
 
CSLA (''Component-based Scalable Logical Architecture'') was originally targeted toward [[Visual Basic]] 6 in the book ''Visual Basic 6.0 Business Objects'' by Lhotka.<ref>Visual ISBNBasic 6.0 Business Objects {{ISBN|1-86100-107-X.}}</ref> With the advent of [[.NET Framework|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|Visual Basic.NET]] and [[C Sharp (programming language)|C#]]).
CSLA.NET was expounded in ''Expert C# Business Objects'' ISBN 1-59059-344-8 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.
 
CSLA .NET was expounded in ''Expert C# Business Objects'' ISBN<ref>Expert C# Business Objects {{ISBN|1-59059-344-8}}</ref> 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.<ref>Using CSLA 4 ({{cite web |url=http://store.lhotka.net/Default.aspx?tabid=1560&ProductID=22 |title=Using CSLA 4 Ebook Series &#124; CSLA .NET Store > Store |accessdate=2013-02-23 |url-status=dead |archiveurl=https://web.archive.org/web/20130311082109/http://store.lhotka.net/Default.aspx?tabid=1560&ProductID=22 |archivedate=2013-03-11 }})</ref>
 
==Features of CSLA==
 
===Smart data===
A business object encapsulates all the data and behavior (including persistencebusiness logic and rules) associated with the object it represents. For example, an orderOrderEdit object will becontain the onlydata partand ofbusiness therule programimplementations tonecessary loadfor anthe order,application obtainto orcorrectly assignallow the order'suser memberto dataedit (order numbers, etc...), save the order, and so oninformation.
 
===TypedRules Collectionsengine===
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]].
The framework defines a standard way to create collection objects which represent a collection of objects. This allows an object model to map well to a [[relational database]]'s [[data model]]. For example, an ''Account'' table could map to an ''Accounts'' (observe the pluralization) collection object (in reality the object model will differ from the relational model, it is therefore necessary to employ [[Object-Relational Mapping]] to resolve the differences). In this case each row in the ''Account'' table would map to an ''Account'' business object which is contained in the ''Accounts'' collection object. This makes it possible to define methods for the collection object that will propagate to its constituent objects. For example, to save all the ''Account'' objects in an ''Accounts'' collection, one would type:
<br /><code>
myAccountsCollection.Save();
</code><br />
The Save() method will call the Save() method on each of its constituent Account objects.
// Inside the Accounts class
public void Save(){
// _accounts will normally be some type of array variable with class scope
// that holds all of the Account objects represented in this collection.
foreach (Account acct in _accounts){
acct.Save(); // The actual Account object does the work of saving itself to the database
}
}
This method of propagating changes to a collection's constituent object can be used for other common methods and property assignments as well(myAccountsCollection.Load(); myAccountsCollection.Active = false;).
Business objects can also contain other collection objects, in effect creating a relationship analogous to a parent child relationship between two tables. For example, the ''Account'' object mentioned above can contain an ''Orders'' collection object which in turn contains ''Order'' objects. In this case, the above call to Save() on the ''Accounts'' collection object could be written to save all of the Account objects as well as all of the orders associated with each of the accounts.
 
===Object persistence===
Data creation, retrieval, updates, and deletes ([[CRUD (acronym)|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.
 
===Persistence stateMetastate maintenance===
CSLA defines.NET amanages standardthe way''metastate'' ofabout allowing aeach business object. toFor maintainexample, informationeach aboutbusiness itsobject "persistencetracks state".information In other words, an object knowsabout 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 back 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===
Line 44 ⟶ 57:
 
==''Extended features of CSLA''==
 
===Simple UI creation===
UsingBusiness objects created using CSLA .NET fully support data binding for all [[Microsoft .NET]] UI technologies, including [[Windows FormsRuntime]] or([[WinRT]]), [[Windows Presentation Foundation|WPF]], [[Web Forms]], data[[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===
UsingThe CSLA .NET framework implements a concept called [[mobile objects]] or [[mobile agents]] to allow objects to move across network boundaries using [[Windows Communication Foundation|WCF]], [[Web Services]], anor objectother cantechnologies. performAs itsa result, the data access enjoys [[___location transparency]], meaning that the logic may run on the client machineworkstation or a server depending on the application's configuration. It can also be configured to use manual [[database transaction]]s 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 servicesservice to remote consumers. This can be done using server-side [[Microsoft .NET]] technologies such as [[Web API]], [[Windows Communication Foundation|WCF]], and [[asmx web services]].
.
 
==References==
 
<references />
* Training
** [http://www.dunntraining.com/cslatraining.htm CSLA.NET Training] {{Webarchive|url=https://web.archive.org/web/20140305082720/http://www.dunntraining.com/cslatraining.htm |date=2014-03-05 }}
* Books
** [https://web.archive.org/web/20130311082109/http://store.lhotka.net/Default.aspx?tabid=1560&ProductID=22 Using CSLA 4 ebook series]
** Expert C# 2008 Business Objects ISBN 978-1-4302-1019-1
** Expert VBC# 2008 Business Objects {{ISBN|978-1-4302-1019-1}}
** Expert C#VB 2008 Business Objects {{ISBN |978-1-4302-10191638-14}}
** Using CSLA .NET 3.0
** CSLA .NET Version 2.1 Handbook
Line 70 ⟶ 88:
** Visual Basic 5 Business Objects
* Web sites
** [http://www.lhotkadunntraining.net/cslanetcom CSLA .NET for WindowsTraining]
** [http://www.lhotkacslanet.net/cslalightcom CSLA .NET forhome Silverlightpage]
** [https://github.com/MarimerLLC/csla CSLA .NET on GitHub]
** [https://web.archive.org/web/20130125092422/http://forums.lhotka.net/forums/5.aspx/ CSLA .NET community forum]
 
==External links==
* [https://web.archive.org/web/20050219025025/http://www.lhotka.net/ Rockford Lhotka's website]
* [http://www.dunntraining.com/ CSLA Training]
*[http://www.lhotka.net/ Rockford Lhotka's website]
**[http://forums.lhotka.net/ CSLA forums]
**[http://www.cslanet.org/ Hispanic Community]
*[http://www.primos.com.au/primos/Articles/tabid/56/Default.aspx The CSLA Framework; what is in it for me?] Articles illustrating CSLA deliverables (version 1.n and version 2)
 
[[Category:Application programming interfaces]]
[[Category:Component-based software engineering]]
[[Category:C Sharp libraries]]