eXpandFramework / eXpand

DevExpress XAF (eXpressApp) extension framework. ๐—น๐—ถ๐—ป๐—ธ๐—ฒ๐—ฑ๐—ถ๐—ป.๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ.๐—ฐ๐—ผ๐—บ, ๐˜†๐—ผ๐˜‚๐˜๐˜‚๐—ฏ๐—ฒ.๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ.๐—ฐ๐—ผ๐—บ and ๐˜๐˜„๐—ถ๐˜๐˜๐—ฒ๐—ฟ @๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ and or simply ๐—ฆ๐˜๐—ฎ๐—ฟ/๐˜„๐—ฎ๐˜๐—ฐ๐—ต this repository and get notified from ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ
http://expand.expandframework.com
Microsoft Public License
220 stars 114 forks source link

Model Mapper mandatory? #505

Closed vimarx closed 4 years ago

vimarx commented 5 years ago

When trying to edit web model with win app (as before), I had the following exception Is now mandatory ModelMapper?

Thanks

10.08.19 10:09:24.967 no context SetupModules VxERP.Win.exe Error: 0 : 10.08.19 10:09:24.994 no context ================================================================================ The error occurred:

Type:       AggregateException
Message:    Se han producido uno o varios errores.
Data:       0 entries
Stack trace:

en Xpand.Utils.Helpers.Retry.Do[T](Func1 action, TimeSpan retryInterval, Int32 retryCount) en Xpand.Utils.Helpers.Retry.Do(Action action, TimeSpan retryInterval, Int32 retryCount) en Xpand.Persistent.Base.ModelDifference.ModelLoader.GetMasterModel(Boolean tryToUseCurrentTypesInfo, Action1 action) en Xpand.ExpressApp.ModelDifference.Win.PropertyEditors.ModelEditorPropertyEditor.GetMasterModelCore(Boolean recreate) en Xpand.ExpressApp.ModelDifference.Win.PropertyEditors.ModelEditorPropertyEditor.GetMasterModel(Boolean recreate) en Xpand.ExpressApp.ModelDifference.Win.PropertyEditors.ModelEditorPropertyEditor.OnCurrentObjectChanged() en DevExpress.ExpressApp.Editors.ViewItem.set_CurrentObject(Object value) en DevExpress.ExpressApp.ObjectView.InitializeItem(ViewItem item) en DevExpress.ExpressApp.DetailView.InitializeItem(ViewItem item) en DevExpress.ExpressApp.CompositeView.AddItem(ViewItem item) en DevExpress.ExpressApp.CompositeView.LoadModelCore() en DevExpress.ExpressApp.ObjectView.LoadModelCore() en DevExpress.ExpressApp.View.LoadModel() en DevExpress.ExpressApp.View.SetModel(IModelView model) en Xpand.ExpressApp.ViewFactory.CreateDetailView(XafApplication xafApplication, String viewId, IObjectSpace objectSpace, Object obj, Boolean isRoot, Boolean enableDelayedObjectLoading) en Xpand.ExpressApp.SystemModule.XpandSystemModule.ApplicationOnDetailViewCreating(Object sender, DetailViewCreatingEventArgs args) en System.EventHandler`1.Invoke(Object sender, TEventArgs e) en DevExpress.ExpressApp.XafApplication.OnDetailViewCreating(DetailViewCreatingEventArgs args) en DevExpress.ExpressApp.XafApplication.CreateDetailView(IObjectSpace objectSpace, String detailViewID, Boolean isRoot, Object obj, Boolean isDelayedObjectLoading, IEnumerable objectsToPrefetch) en DevExpress.ExpressApp.XafApplication.CreateDetailView(IObjectSpace objectSpace, String detailViewID, Boolean isRoot, Object obj) en DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController.ShowObjectCore(Object obj, ShowViewParameters showViewParameters, XafApplication application, View sourceView, IObjectSpace objectSpace, IEnumerable objectsToPrefetch) en DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController.ProcessCurrentObject(SimpleActionExecuteEventArgs e) en DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController.processCurrentObjectAction_OnExecute(Object sender, SimpleActionExecuteEventArgs e) en DevExpress.ExpressApp.Actions.SimpleAction.RaiseExecute(ActionBaseEventArgs eventArgs) en DevExpress.ExpressApp.Actions.ActionBase.ExecuteCore(Delegate handler, ActionBaseEventArgs eventArgs)

InnerException:

        Type:       InvalidOperationException
        Message:    Exception occurs while initializing the 'Xpand.ExpressApp.Web.SystemModule.XpandSystemAspNetModule' module: _xafWebAssembly check that ModelMapperModule is added to the RequiredModuleTypes collection
        Data:       0 entries
        Stack trace:

en Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModules(ApplicationModulesManager instance) en SetupModules_Patch1(ApplicationModulesManager ) en DevExpress.ExpressApp.ApplicationModulesManager.Load(ITypesInfo typesInfo, Boolean loadTypesInfo) en Xpand.Persistent.Base.ModelDifference.ModelBuilder.CreateModulesManager(XafApplication application, String configFileName, String assembliesPath, ITypesInfo typesInfo) en Xpand.Persistent.Base.ModelDifference.ModelBuilder.Build(Boolean rebuild) en Xpand.Persistent.Base.ModelDifference.ModelLoader.GetMasterModelCore(Boolean rebuild) en Xpand.Persistent.Base.ModelDifference.ModelLoader.GetMasterModel(XafApplication xafApplication, Action`1 action) en Xpand.Persistent.Base.ModelDifference.ModelLoader.<>c__DisplayClass12_0.b0() en Xpand.Utils.Helpers.Retry.<>c__DisplayClass0_0.b__0() en Xpand.Utils.Helpers.Retry.Do[T](Func`1 action, TimeSpan retryInterval, Int32 retryCount)

        InnerException:

                Type:       NullReferenceException
                Message:    _xafWebAssembly check that ModelMapperModule is added to the RequiredModuleTypes collection
                Data:       0 entries
                Stack trace:

en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.CheckRequiredParameters(String xafAssemblyName, String controlAssemblyName) en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.GetModelMapperConfiguration(PredefinedMap predefinedMap) en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.ModelMapperConfiguration(PredefinedMap predefinedMap, Action1 configure) en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.Extend(ApplicationModulesManager modulesManager, PredefinedMap map, Action1 configure) en Xpand.ExpressApp.Web.SystemModule.XpandSystemAspNetModule.Setup(ApplicationModulesManager moduleManager) en Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModules(ApplicationModulesManager __instance) InnerException is null

apobekiaris commented 5 years ago

this case should probably fail as I never tested and support it. I will update u again.

vimarx commented 5 years ago

the editing of web models within win app is not working in 19.1.503.0 BTW, this was a nice feature!

apobekiaris commented 5 years ago
  1. i created a new win web solution
  2. Run the web
  3. copy the web assemblies into the win debug folder
  4. run the win and edit both models without errors

happy to research further on a failing sample

vimarx commented 5 years ago

Where do I have to include this reference? (the modelmappermodule)

Type: NullReferenceException Message: _xafWebAssembly check that ModelMapperModule is added to the RequiredModuleTypes collection Data: 0 entries Stack trace:

en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.CheckRequiredParameters(String xafAssemblyName, String controlAssemblyName) en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.GetModelMapperConfiguration(PredefinedMap predefinedMap) en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.ModelMapperConfiguration(PredefinedMap predefinedMap, Action1 configure) en Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.Extend(ApplicationModulesManager modulesManager, PredefinedMap map, Action1 configure) en Xpand.ExpressApp.Web.SystemModule.XpandSystemAspNetModule.Setup(ApplicationModulesManager moduleManager) en Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModules(ApplicationModulesManager __instance) InnerException is null

apobekiaris commented 5 years ago

it means u need to install the module if not already installed

emeyke commented 5 years ago

Has this worked? I am still getting the same modelmapper required error when trying to edit the web model although it is installed. Just in case my sample project. https://www.dropbox.com/s/s9gngeouo16qrwf/Core.zip?dl=0

isatahiri commented 4 years ago

Hello,

I have a similar issue in the module.win model :

Exception occurs while initializing the 'Xpand.ExpressApp.Win.SystemModule.XpandSystemWindowsFormsModule' module: _xtraLayoutAssembly check that ModelMapperModule is added to the RequiredModuleTypes collection

In the Win module designer, i adde the following : this.RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.ModelMapper.ModelMapperModule));

But the error persists and so i cannot open the model in module.win. I can open the model module, win web.module and web without adding any module.

Detail : at Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModules(ApplicationModulesManager applicationModulesManager) in D:\a\1\s\src\Modules\Reactive\ReactiveModuleBase.cs:line 35 at Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModulesPatch(ApplicationModulesManager __instance) in D:\a\1\s\src\Modules\Reactive\HarmonyPatches\ReactiveModuleBasePatch.cs:line 17 at SetupModules_Patch1(ApplicationModulesManager ) at DevExpress.ExpressApp.ApplicationModulesManager.Load(ITypesInfo typesInfo, Boolean loadTypesInfo) at DevExpress.ExpressApp.Utils.DesignerModelFactory.CreateModulesManager(ModuleBase module, String assembliesPath, List1 additionalModules, ISecurityStrategyBase securityInstance) at DevExpress.ExpressApp.Design.ModelEditor.ModelLoader.LoadModel(ITypeDiscoveryService typeDiscoveryService, ITypeResolutionService typeResolutionService, String targetDiffFileName, IDisposable& obj) at DevExpress.ExpressApp.Design.ModelEditor.EditorPane.CreateModelEditorController() at DevExpress.ExpressApp.Design.ModelEditor.EditorPane.ReInit() ----------InnerException---------- _xtraLayoutAssembly check that ModelMapperModule is added to the RequiredModuleTypes collection ----------StackTrace---------- at Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.CheckRequiredParameters(String xafAssemblyName, String controlAssemblyName) in D:\a\1\s\src\Modules\ModelMapper\Services\PredefinedMapService.cs:line 717 at Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.GetModelMapperConfiguration(PredefinedMap predefinedMap) in D:\a\1\s\src\Modules\ModelMapper\Services\PredefinedMapService.cs:line 632 at Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.ModelMapperConfiguration(PredefinedMap predefinedMap, Action1 configure) in D:\a\1\s\src\Modules\ModelMapper\Services\PredefinedMapService.cs:line 250 at Xpand.XAF.Modules.ModelMapper.Services.PredefinedMapService.Extend(ApplicationModulesManager modulesManager, PredefinedMap map, Action`1 configure) in D:\a\1\s\src\Modules\ModelMapper\Services\PredefinedMapService.cs:line 173 at Xpand.ExpressApp.Win.SystemModule.XpandSystemWindowsFormsModule.Setup(ApplicationModulesManager moduleManager) in D:\a\1\s\Xpand\Xpand.ExpressApp\Xpand.ExpressApp.Win\SystemModule\XpandSystemWindowsFormsModule.cs:line 88 at Xpand.XAF.Modules.Reactive.ReactiveModuleBase.SetupModules(ApplicationModulesManager applicationModulesManager) in D:\a\1\s\src\Modules\Reactive\ReactiveModuleBase.cs:line 28

isatahiri commented 4 years ago

Actually after rebooting VS it worked. The clean and rebuild did not work.

vimarx commented 4 years ago

Has this worked? I am still getting the same modelmapper required error when trying to edit the web model although it is installed. Just in case my sample project. https://www.dropbox.com/s/s9gngeouo16qrwf/Core.zip?dl=0

is this issue solved in 19.2.300.x?

vimarx commented 4 years ago

Has this worked? I am still getting the same modelmapper required error when trying to edit the web model although it is installed. Just in case my sample project. https://www.dropbox.com/s/s9gngeouo16qrwf/Core.zip?dl=0

is this issue solved in 19.2.300.x?

vimarx commented 4 years ago

Sample project in 19.2.3 failing to load web model in Win repos.zip

This was a nice feature!

vimarx commented 4 years ago

the problem is still in 19.2.4, anyone had some success on workaround it?

vimarx commented 4 years ago

any news on this?

apobekiaris commented 4 years ago

adding a priority tag

apobekiaris commented 4 years ago

Issue is prioritized as it contains one of the following labels sponsor, installation, contribution, nuget, breakingchange, ReproSample, Deployment, Backer

apobekiaris commented 4 years ago

Solution9.zip I failed to repro the case please modify my sample to demo the problem

vimarx commented 4 years ago

I added several modules lines and fails this.RequiredModuleTypes.Add(typeof(DevExpress.ExpressApp.Web.SystemModule.SystemAspNetModule)); this.RequiredModuleTypes.Add(typeof(Xpand.ExpressApp.ModelDifference.Web.ModelDifferenceAspNetModule)); this.RequiredModuleTypes.Add(typeof(Xpand.ExpressApp.ExcelImporter.Web.ExcelImporterWebModule)); this.RequiredModuleTypes.Add(typeof(Xpand.ExpressApp.Validation.Web.XpandValidationWebModule)); this.RequiredModuleTypes.Add(typeof(Xpand.ExpressApp.Web.SystemModule.XpandSystemAspNetModule));

b1.zip

apobekiaris commented 4 years ago

thnks for the sample, I researched this case and will be fixed in the next minor. However I want to make a few notes that was respected before and now.

  1. You may get FileLoadExceptions if for some reason an assembly used from the web app is not found in the bin of your win app, the solution is to add it there manually or reference it in your web so it will be copied once build as in the sample where I faced an issue where the Xpand.ExpressApp.ExcelImporter which after I reference it it worked. it really depends on your config and how the assemblies are discovered. If for e.g there are in GAC or you have some other config they should be discovered.
  2. Due to the hacking nature of this feature sometimes if there is an exception of some TypeNotFound e.g. for Xpand validation rules just reference the platform module in both sides Win/Web
expand commented 4 years ago

The DevExpress.XAF repository includes commits that relate to this task:

Please update the related Nuget packages and test if issues is addressed. These are nightly nuget packages available only from our NugetServer.

If you do not use the Xpand.XAF.Modules directly but through a module of the main eXpandFramework project, please wait for the bot to notify you again when integration is finished or update the related packages manually.

Thanks a lot for your contribution.

apobekiaris commented 4 years ago

Solution9.zip

posting my modified sample which respects the previous notes

expand commented 4 years ago

eXpand.lab release 19.2.502.4 includes commit that relate to this task:

Please test if it addresses the problem. If you use nuget add our LAB NugetServer as a nuget package source in VS.

Thanks a lot for your contribution.

expand commented 4 years ago

Issue is deprioritized as no Assignee found and scheduled for auto-close if no activity in the next 60 days.

emeyke commented 4 years ago

@vimarx can you confirm it is working for you now? I.e. opening web model.

vimarx commented 4 years ago

@emeyke, couldn't test it because of #669

apobekiaris commented 4 years ago

did u test the sample posted b4?

https://github.com/eXpandFramework/eXpand/issues/505#issuecomment-580270585

expand commented 4 years ago

Closing issue for age. Feel free to reopen it at any time.

.Thank you for your contribution.