This project intends to contribute to the AlloyMDA project, adding support for transforming Alloy models into C# models to be used with Microsoft's official ORM, Entity Framework (EF).
The generated C# code is ready to be used in a project with Entity Framework using the Code First approach in order to create the structure of the database through Migrations.
- Get Alloy2Cs (this already includes the AlloyMDA project)
- Download and install Haskell
- Get Cabal's latest list of packages by running
cabal update. Cabal is a system for building and packaging Haskell libraries and programs. - Install the required syb dependency with
cabal install syb. - Open a new terminal window and go to the project folder.
- Run
cabal sandbox initto initialize a sandbox environment to avoid package conflicts between different projects. - Install dependencies with
cabal install mtl parsec. - Compile and create the tool by running
ghc --make Tools/Alloy2Cs.hs -o alloy2cs. - Run the tool:
alloy2cs < Alloy/Examples/Book.als
Entity Framework (EF) is the Microsoft's official ORM tool. There are currently two versions:
- Entity Framework 6 (EF6), a tested, stable data access technology with lots of features.
- Entity Framework Core (EF Core), a lightweight, extensible, and cross-platform version of Entity Framework.
It means Alloy2Cs could be used with:
- EF Core 1.x
- EF Core 2.0.1 (current version at the time of publication) as well as all previous versions.
- EF 6. In this case, it may be necessary to add additional configuration settings before running the migrations to create the database.
Alloy2Cs is an extension of the existing AlloyMDA project. Hence it's also written in Haskell.
AlloyMDA intends to develop tools to enable MDA support for Alloy, a formal modeling language.