Switching to VS from MDrivenDesigner to access codedress
No edit summary
No edit summary
 
Line 1: Line 1:
Start visual studio, create a new project, use Template MDrivenEcoSpaceAndModelProject
Start Visual Studio, create a new project, and use Template MDrivenEcoSpaceAndModelProject:


[[File:Switching to VS to access codedress from MDrivenDesigner 1712221091635.png|frameless|542x542px]]
[[File:Switching to VS to access codedress from MDrivenDesigner 1712221091635.png|frameless|542x542px]]
Line 5: Line 5:
Delete EcoSpace and PMP since we only want model.
Delete EcoSpace and PMP since we only want model.


Open the EcoProject1.ecomdl, Delete exeisting content, classes,Views, Actions, then:
Open the EcoProject1.ecomdl - Delete existing content, Classes, Views, and Actions, then:


MDriven tab, Import modlr (if you currently have your model in ecomdl do a save as modlr in order to import everything ):
MDriven tab, Import modlr (if you currently have your model in ecomdl, do a save as modlr in order to import everything):
[[File:Switching to VS to access codedress from MDrivenDesigner 1712221271063.png|none|thumb|521x521px]]
[[File:Switching to VS to access codedress from MDrivenDesigner 1712221271063.png|none|thumb|521x521px]]
Are you using NetFramework4.7+  -> install/update nuget packages  
Are you using NetFramework4.7+  -> install/update Nuget packages  


Are you using .netCore, .net6+ -> Create a .net6 project - move the model file to this project, install nuget packages: MDriven.Interfaces, MDriven.Handles,MDriven.LinqExtender,  
Are you using .netCore, .net6+ -> Create a .net6 project - move the model file to this project, install Nuget packages: MDriven.Interfaces, MDriven.Handles,MDriven.LinqExtender,  


Remember to move your <modelname>_AssetsTK into the project, same level as ecomdl file.  
Remember to move your <modelname>_AssetsTK into the project, same level as ecomdl file.
Build. Then codegen:  
 
Build. Then Codegen:  
[[File:Switching to VS to access codedress from MDrivenDesigner 1712221682747.png|none|thumb|601x601px]]
[[File:Switching to VS to access codedress from MDrivenDesigner 1712221682747.png|none|thumb|601x601px]]
From this point forward you use VS to upload.   
From this point forward, use VS to upload.   


From this point forward you must press codegen whenever you do anything that effects model structure (classes, associations, statemachines)  
From this point forward, you must press Codegen whenever you do anything that effects model structure (classes, associations, statemachines)  


From this point forward you must build your project (F5 in VS) prior to upload so that the latest build is used for codedress 
From this point forward, you must build your project (F5 in VS) prior to upload so that the latest build is used for CodeDress. 


Now when you add a Method to a Class and leave the Body(eal) field empty - a stub is generated in c#:  
Now when you add a Method to a Class and leave the Body(eal) field empty - a stub is generated in C#:  
[[File:Switching to VS to access codedress from MDrivenDesigner 1712221899111.png|none|thumb|530x530px]]The great thing with codedress is that you now have access to your complete model from c# and you can use third party logic from assemblies/nugets and call those from your model code.
[[File:Switching to VS to access codedress from MDrivenDesigner 1712221899111.png|none|thumb|530x530px]]The great thing with CodeDress is that you now have access to your complete model from C# and can use third party logic from Assemblies/Nugets and call those from your model code.


We however suggest you refrain from putting ALL your logic(derivations etc) in c# even if you CAN since it hampers the cross reference and look-ahead-smartness that MDriven can do by inspecting ocl expressions. But it is a great complement to give you zero limitations in your system building.
We, however, suggest you refrain from putting ALL your logic(derivations etc) in C# even if you CAN since it hampers the cross reference and look-ahead-smartness that MDriven can do by inspecting OCL expressions - but it is a great complement to give you zero limitations in your system building.
[[Category:TOC]]
[[Category:TOC]]

Latest revision as of 05:01, 2 May 2024

Start Visual Studio, create a new project, and use Template MDrivenEcoSpaceAndModelProject:

Switching to VS to access codedress from MDrivenDesigner 1712221091635.png

Delete EcoSpace and PMP since we only want model.

Open the EcoProject1.ecomdl - Delete existing content, Classes, Views, and Actions, then:

MDriven tab, Import modlr (if you currently have your model in ecomdl, do a save as modlr in order to import everything):

Switching to VS to access codedress from MDrivenDesigner 1712221271063.png

Are you using NetFramework4.7+ -> install/update Nuget packages

Are you using .netCore, .net6+ -> Create a .net6 project - move the model file to this project, install Nuget packages: MDriven.Interfaces, MDriven.Handles,MDriven.LinqExtender,

Remember to move your <modelname>_AssetsTK into the project, same level as ecomdl file.

Build. Then Codegen:

Switching to VS to access codedress from MDrivenDesigner 1712221682747.png

From this point forward, use VS to upload.

From this point forward, you must press Codegen whenever you do anything that effects model structure (classes, associations, statemachines)

From this point forward, you must build your project (F5 in VS) prior to upload so that the latest build is used for CodeDress.

Now when you add a Method to a Class and leave the Body(eal) field empty - a stub is generated in C#:

Switching to VS to access codedress from MDrivenDesigner 1712221899111.png

The great thing with CodeDress is that you now have access to your complete model from C# and can use third party logic from Assemblies/Nugets and call those from your model code.

We, however, suggest you refrain from putting ALL your logic(derivations etc) in C# even if you CAN since it hampers the cross reference and look-ahead-smartness that MDriven can do by inspecting OCL expressions - but it is a great complement to give you zero limitations in your system building.

This page was edited 15 days ago on 05/02/2024. What links here