0

a code MyController:ModelDrivenControllerBase<EcoProject1EcoSpace> in the mvc or webapi netcore project shows a error "the type 'MDrivenTemplateProj.EcoProject1EcoSpace' cannot be used as type parameter 'ESType' in the generic type or method 'ModelDrivenControllerBase<ESType>'. There is no implicit reference conversion from 'MDrivenTemplateProj.EcoProject1EcoSpace' to 'Eco.Handles.DefaultEcospace" + annoying request to add ref to the 'MDriven.Handles.netStandard, version=7.0.0.0, culture=neutral, publickeytoken=null'. (always version 7.0.0.0!)
Could you please advise how to avoid such kind of errors?
I'm trying to develop the webapi netcore 3.1 app that has ref to MDrivenEcoSpaceAndModelForNetStandard project using the NetFramework 4.x. experience.
Seems that is it wrong way for the netcore project.
Thank you!

Alex
  • 107
  • 9

2 Answers2

1

Brand new MDriven packages on nuget targeting .netStandard2.1 and .net5 available now. They have correct build version numbers, and are more granular in packages than the old Eco package.

https://wiki.mdriven.net/index.php/MVC

https://www.nuget.org/packages?q=MDriven*

Hans Karlsen
  • 2,275
  • 1
  • 15
  • 15
0

Old style still valid:

  1. ref to the MDrivenEcoSpaceAndModelForNetStandard project in your netcore webapi
  2. leave ControllerBase as a base class for your MVC controller
  3. create and activate new ecospace in the constructor of your controller
_es = new MDrivenTemplateProj.EcoProject1EcoSpace();_es.Active = true;  
  1. you can call CreateFromViewModel method if you want to use VMs, ex.
var vmc = Eco.ViewModel.Runtime.ViewModelHelper.CreateFromViewModel("SampleViewModel", this._es, null, false);  

Manual fixes that are still required in MDrivenEcoSpaceAndModelForNetStandard project:

  • EcoProject1EcoSpace.Designer.cs - this.persistenceMapperSharer1.MapperProviderTypeName auto generated value is incorrect
  • EcoProject1PMP.Designer.cs - this.EcoSpaceTypeName auto generated value is incorrect
  • be ready that your build in VS EcoProject modeller will not be able to start persistence after the fixes above. It will show you "No suitable constructor found" message
Peter Csala
  • 17,736
  • 16
  • 35
  • 75
Alex
  • 107
  • 9