Toolset
Installation
Most recent MvcLang (v2) version and previous version (v1) is accessible from GitHub link below:
https://github.com/iremfidandan/MvcLangv2
Obeo Designer Community Edition is required to execute MVCLang Modelling Editor. It can be downloaded from:
https://www.obeodesigner.com/en/download
Metamodelling Project Setup
Create a new workspace folder.
Open Obeo Designer and click Browse... button.
Select the workspace folder that you created according to 1. Step from file system.
Click Launch button.
Click Window -> Perspective -> Open Perspective -> Other... -> Git
Click Clone a Git Repository from Git Repositories
Copy https://github.com/iremfidandan/MvcLangv2 and paste it URI textbox.
Click Next button.
Uncheck MvcLangv1 and click Next button.
Click Finish button.
Right click on recently cloned repo and click Import Projects...
Click Deselect All button and then select only CodeGenerationPrototype projects.
Click Finish button.
Click Window -> Perspective -> Open Perspective -> Other... -> Modelling
Right click on com.eryaz.prototype.ryz and click Properties
Click Java Build Path and then Click Source tab.
Click on com.eryaz.prototype.ryz/src, click Remove button and click Apply and Close button.
Right click com.eryaz.prototype.ryz -> Run As -> Run Configurations
Right click on Eclipse Application -> New Configuration, click Apply and click Run.
Modelling Project Setup
Click Window -> Perspective -> Open Perspective -> Other... -> Git
Click Add An Existing Local Git Repository To This View.
Check only mvcLang and click Add.
Right click on mvcLang and click Import Projects...
Click Select All button and click Finish button.
Click Window -> Perspective -> Open Perspective -> Other... -> Modelling
Create New MVCLang Project
Click File -> New -> Other… -> Example EMF Model Creation Wizards –> Ryz Model
Click Next button.
Select Parent Folder as com.eryaz.prototype.ryz.modeltest and give an arbitiary name for your ryz model.
Click Next button.
Select Model Object as Project.
Click Finish button.
Click on the arrow that is on the left side of .ryz file you created recently according to 3. step from Model Explorer.
Click Project and give an arbitiary name from Properties View.
Right click on Project that in the .ryz file and click New Representation -> Other respectively.
Select projects -> Projects Diagram and click Finish button respectively.
Click OK button.
Generate Code From A Model
In the modelling editor, right click on com.eryaz.prototype.ryz.codegeneration -> src -> com.eryaz.prototype.ryz.codegeneration.main -> generate.mtl and click Run As -> Run Configurations.
Right click on Acceleo Application and click New Configuration.
Give a name to your run configuration.
Click Search… button inside Main Class group and select com.eryaz.prototype.ryz.codegeneration.main.Generate.
Click Browse… button inside Model and select ryz model that you created.
Click Browse… button inside Target and select com.eryaz.prototype.ryz.generatedcodes.
Click Apply and Run buttons respectively.
If you want to regenerate code from your model, click Run button’s menu on the toolbar and then click your run configuration.
Running Auto-Generated Codes On Visual Studio 2015
Open Visual Studio 2015 and click File -> New Project.
Click Installed -> Templates -> Visual C# -> Web -> ASP.NET Web Application and give a name to your solution and project.
Click OK button.
Select Empty Template and check MVC checkbox from Add folders and core references for.
Click OK button.
Click Tools -> Extensions and Updates and install SQLite/SQL Server Compact Toolbox.
Click Tools -> SQLite/SQL Server Compact Toolbox.
Right click on Data Connections from SQLite/SQL Server Compact Toolbox and click Add SQL Server Compact Connection.
Click Create… button and create your application’s db file on where you want.
Copy auto-generated connection string.
Right click on the solution that you created according to 5. Step and click Manage NuGet Packages for Solution.
Install EntityFramework and EntityFramework.SqlServerCompact respectively.
Open Web.config file in your project root and paste below xml between <configSections> and <appSettings> tags.
<connectionStrings>
<add name="<your case study’s project name>Context" connectionString="Data Source=<autogenerated connection string that you copied> providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
Click View -> Other Window -> Package Manager Console.
Write below commands respectively on Package Manger Console
enable-migrations -enableautomaticmigration
add-migration <Your Migration Class Name>
update-database
Right click on the solution that you created according to 5. Step and click Manage NuGet Packages for Solution.
Search for Ninject.MVC5, set Dependency Behavior to Highest and File Conflict Action to Prompt and install it.
Open autogenerated App_Start ->Ninject.Web.Common.cs file and paste these code lines inside RegisterServices method.
<your case study’s project name>Context context = new <your case study’s project name>Context();
context.Database.Initialize(force: false);
UnitOfWork uow = new UnitOfWork(context);
kernel.Bind<IUnitOfWork>().ToConstant<UnitOfWork>(uow);
Right click on the solution that you created according to 5. Step and click Manage NuGet Packages for Solution.
Install JQuery and Microsoft.jQuery.Unobtrusive.Ajax respectively.