[Pet Shop Reloaded] Getting Started


We know now what are the functional and technical context of our application: Pet Shop Reloaded. We can now start to prepare our working environment.



Getting ready with CodeFluent Entities

CodeFluent Entities is fully integrated into Visual Studio and really easy to install. We need to go to the installation page of CodeFluent Entities, download an .msi file and run it.

Download CodeFluent Entities

Download CodeFluent Entities

We just need to follow the wizard installer.
Installing CodeFluent Entities

Installing CodeFluent Entities

The installer will add a Visual Studio extension so you can access all the CodeFluent Entities features directly from your favorite IDE. So now that we have successfully installed CodeFluent Entities, let’s open Visual Studio and see that there is now a CodeFluent Entities menu.
CodeFluent Entities Menu

CodeFluent Entities Menu

You need to request a License to use CodeFluent Entities, there is a totally free, unlimited in time and full-featured license for personal use.
Request a FREE License

Request a FREE License

We will also find the CodeFluent Entities project templates when adding a new project from Visual Studio.
CodeFluent Entities project templates

CodeFluent Entities project templates

For the Pet Shop Reloaded we will add a new CodeFluent Entities blank project.

To discover CodeFluent Entities you can use a sample model provided with the project templates.


Getting ready with Entity Framework 5

Entity Framework on its version 5 is already integrated into Visual Studio 2012.
If you are using Visual Studio 2010 you will need to manually install the latest version of Entity Framework (version 5) from NuGet, you can refer to this page or this one to know more about installing the Entity Framework from NuGet.

If you use Visual Studio 2010 you will also need to install the DbContext generator, see the “Additional Steps in Visual Studio 2010” point.

To add a new Entity Framework model (.edmx), we need to add a new item in an existing project. For the Pet Shop Reloaded application we will host the Entity Framework model right on the ASP.NET MVC project.

Entity Framework does not contain an independent project template, it is added to an existing C# project.

So we add a “New Item” and on the “Data” tab we choose “ADO.NET Entity Data Model”:

Add a Entity Model

Add a Entity Model

As we are going to use the Model First approach as our Model Creation Workflow, we select the “Empty Model” option.
Empty Entity Model

Empty Entity Model

There are essentially 3 different Model Creation Workflows: Model First, Data First and Code First. If you want to know more about this you can take a look at this blog post.
You can extend the Entity Framework behavior by modifying or adding .tt templates.



The CodeFluent Entities project

CodeFluent Entities has its own project on Visual Studio terms. As you have a “Class Library” project, a “WPF” project or an “ASP.NET MVC” project, you will have a “CodeFluent Entities” project in your Visual Studio Solution.
The image below shows the main structure of a CodeFluent Entities project.

CodeFluent Entities project structure

CodeFluent Entities project structure


  • References: to add assembly references.
  • Files: to store templates for example.
  • Surfaces: contains the Modeler design surfaces (you can split your model on different design surfaces).
  • Parts: where are stored the XML files (.cfp file extension) that contain the definition of our model (entities, properties, producers…).
  • UserTypes: custom types that can be used as property types on the model.
  • Stores: persistence configurations.
  • Aspects: contains the available aspects.
  • Producers: “code generators” for different layers of our application(s) (Persistence, Business Object Model, Web Services, Web site, Azure, SharePoint…).
  • Model: contains a tree view of our model grouped by “namespaces”.


The Entity Framework structure

The Entity Framework model relies on a XML file with an .edmx extension. As we said earlier, an Entity Framework Model must be integrated in a Visual Studio project. For the Pet Shop Reloaded application we are going to call the Entity Framework model “Model.edmx”.

Entity Framework files structure

Entity Framework files structure

Under the Model.edmx file we can see different items (essentially code generators, .tt files, aka T4 templates).

On earlier versions of Entity Framework (before version 5) the code generation templates are not located under the .edmx file but at the project level.


  • Model.edmx: the Entity Framework model.
  • Model.Context.tt: will generate the Entity Framework Context.
  • Model.Designer.cs: default code generation (disabled by default so the T4 templates are used to generate the code).
  • Model.edmx.diagram: a XML definition of our model diagram.
  • Model.tt: T4 template that will generate POCO classes from our model.


Updates and extensions


Updating the CodeFluent Entities version

It is important to always have the latest version of CodeFluent Entities (in general it is the case for software products), this way you will have the newest features and fixes.
CodeFluent Entities is shipped with a tool called the “SoftFluent Licensing”, you will find it under the CodeFluent Entities installation folder: Program Files (x86)\SoftFluent\CodeFluent\ModelerSoftFluent.Licensing.Client.exe
This tool allows you to know if there is a newer version of CodeFluent Entities.

CodeFluent Entities Licensing

CodeFluent Entities Licensing

For each build version you will find the list of new features and bug fixes.
Update the CodeFluent Entities version

Update the CodeFluent Entities version

CodeFluent Entities does not need any external component, plugin or extension to work, it provides a lot of features and concepts. And if you need more or a specific feature you can easily extend CodeFluent (templates, producers, aspects…).


Updating and extending Entity Framework

Entity Framework is available as a NuGet package (or integrated to Visual Studio) so it can be updated from Visual Studio (or the NuGet console). You can also find extensions or templates (code generators) online.
If you consider that the default code generation of Entity Framework is not enough for your project, then you can modify or add T4 templates to adapt your model to your needs.

On the next blog post we are going deeper on each product, starting on how we will design the model of the Pet Shop Reloaded application.
Remember that you can find all the blog posts related to the Pet Shop Reloaded by SoftFluent under the tag “Pet Shop Reloaded“. Stay tuned. 🙂


The SoftFluent Team

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s