Starting a new project

This post will help you start a new project with the Data Access Application template. Here below is the description of the full process. You may also want to have a look at our related screencast which covers the first part of this post.


Before extracting the archive, your project’s daily branch shall already be created under your source control, or at least the folder that you will later convert into a branch. When this folder is ready, unzip the archive inside it. Three folders are created in your branch:

  • Binaries: all the framework and third-party assemblies that are referenced in the project;
  • Resources: project’s resources;
  • Source: the entire source code of the application template.

Open the Resources folder and run the file called Initialize Project.exe in administrator mode. A command prompt is launched, first asking you to mention the path to the source code (Figure 1).


Figure 1

If you didn’t change the folders names and structure after unzipping the archive then you can just leave the line empty and press the Enter key. You then have to enter the name you want for your project. Please avoid spaces, accents and special characters as this name will be used to rename namespaces, files and types in your project (Figure 2).


Figure 2

Press the Enter key to validate your entry. The update process will start and display all files that are modified (Figure 3). You can exit the command prompt when the process is over.


Figure 3


Go to the Source folder and open the main solution file (not the one that ends with Service). The template uses code generators that are based on a central configuration file. This file is attached as a solution item and is named KeepItSoft.Fwk.Utility.ttinclude. When you open it, you’ll find three static classes that you have to configure before you start. The following section which describes those classes and their members will help you configuring your project at best according to your needs. Please note that the initialization batch already made some modifications to this file based on your project’s name.

The ProjectConfigurator class holds the most important members of the configuration, since all generators use at leat one of them. All properties’ default values are set in the constructor, so the only thing you have to do is check the values that are set in it and modify them if necessary. Please find below a description of the members of this class:

  • EntityDataModelFilePath: the path to the entity data model file. Please be aware that the location always start from where the generator is. So, by default, all generator files are located one folder lower than the solution. This is why the default value starts with “..\”.
  • BaseClassPrefix: this prefix is used to generate base classes with a common name in the entire solution. This includes managers, repositories, services, …
  • UseService: indicates whether or not you want to use the service layers
  • UseLogger: indicates whether or not you want to use a logger.
  • UserReadOnlyComplexTypes: indicates whether or not complex types of the entity data model shall be used as read-only entity types. If so, no validators will be required for complex types and only read methods will be available.
  • Views: this property holds the list of entity types that you don’t want to be updatable. Just like complex types, all entity types included in this list won’t require any validator and only read methods will be available.

The NamespaceConfigurator class holds the namespaces that are used by generator files. Just check that the initial values that are set in the constructor are correct according to your project’s namespaces.

The DataContractConfigurator class holds the serialization configuration of your entities. Please find below a description of the members of this class:

  • MarkAsDataContract: indicates whether or not the DataContract attribute is required for generated entity types.
  • MarkAsDataMember: indicates whether or not the DataMember attribute is required.
  • MarkDataContractAsCircularReference: indicates whether the IsReference option shall be set to true in the DataContract

When you are done with the configuration, you can run all generators in order to update the generated code. This step in not required if you didn’t change anything to the configuration. If you want to check one generator at a time then go to each project holding one, right click the file (with a .tt extension) and click the Run Custom Tool option. Otherwise, you may just want to use the Transform All T4 Templates option under the Build menu (Figure 4).


Figure 4

Your project is now ready. Your next step shall be to map your entity data model to your database.