Hi everybody, back here again to talk about CSLA.NET, in the previous post I mentioned how this Framework and have decided that the best is to learn with a practical example.

To start, I want to make a small application that is made up of only 4 tables and allow maintenance, creating very simple validation rules and a transaction for you to see how easy that will result if they develop an application with Windows Forms.

The technologies that I will use in this project are:

As you can see you don’t need much to advance, they should only have Visual Studio 2013 Community Edition or higher.

Let’s start creating 3 projects:


Then in the DemoCSLA.Datos project, we add an Entity Data Model:


Choose the option ‘Empty EF Designer Model’


Then we create an entity in the following manner:


We then create a scalar property:


By default, all properties scalars are created as ‘String’, to change its type only simply select a property and press the F4 key:


The types of data for the properties are:


The model we should be as well:


Now we create the relationship between the tables by selecting the ‘Association’ object in the Toolbox.


Once selected just drag from the entity of origin to the destination entity relationship that we want to create, the model should look like the following:

Entity Data Model DemoCSLA

We are now heading towards Server Explorer (Ctrl + W + L) and create a local database:


We give the name DemoCSLADb:


We make sure that you have created the database correctly:


Now in an empty part of the model right click and select the option ‘ Generate Database from Model’


As we have previously created the database, by default we have selected such a connection.


Pressing the next button, you should see the Script that we have generated, we indicate the resulting Script name and can then adapt it to our needs:


Since created as String fields are defined as NVARCHAR (MAX) I have replaced the word MAX for number 200, so I give a fixed string fields size:


Finally execute the modified Script and select the connection:


Here we have created our practical example data access layer, stay tuned to the next part to create the business objects of CSLA. NET.

They can go and see the progress of the project in my personal repository from GitHub.


See you soon!