eXpand
eXpand copied to clipboard
Cannot open ModelEditor
𝗗𝗲𝘀𝗰𝗿𝗶𝗯𝗲 𝘁𝗵𝗲 𝗯𝘂𝗴 I have created a new XAF application with DevExpress 21.1 and latest eXpand Framework. I have included the ModelDifference eXpand Module in the application. When I start the windoes application from Visual Studio, 2 ModelDifference objects (System and User) are created in the database as expected. Likewise when I start the web application from Visual Studio, 2 new Model Difference objects are created. The problem occurs when I want to edit the Model Difference objects. When I double click one of the Model Difference Object in the Windows application, I get the error: One or more errors occured with the inner exception:
FileNotFoundException: The ModelEditor requires a valid ModelAssembly. Reference the Xpand.ExpressApp.ModelDifference assembly in your front end project, override the superEDI2.Win.superEDI2WindowsFormsApplication GetModelAssemblyFilePath to provide a valid filename using the call this.GetModelFilePath()
I don't understand what it wants me to do. The Model Difference is stored in the database so what ModelFilePath am I supposed to provide?
For some reason I am not able to attach the project to this report, but I can send it to you if it helps.
𝗛𝗼𝘄 𝘄𝗲 𝗽𝗿𝗶𝗼𝗿𝗶𝘁𝗶𝘇𝗲 𝗶𝘀𝘀𝘂𝗲𝘀 06. Showstopper
We will try to answer all questions that do not require research within 24hr. To prioritize cases that require research we use the following labels in order.
- ❇️ Exclusive-Services
- ❤ Bronze Sponsor
- ❤ Sponsor
- ❤ Backer
- Installation
- ShowStopper
- Nuget
- Contribution
- BreakingChange
- ReproSample
- Deployment
- Must-Have
For all other issues the posting time is respected.
- override the
superEDI2.Win.superEDI2WindowsFormsApplication GetModelAssemblyFilePath - provide a valid filename using the call
this.GetModelFilePath()
the module overrides many parts of how XAF works, so these instructions are required as instructed from the exception. Did you try them? What is not clear?
For some reason I am not able to attach the project to this report, but I can send it to you if it helps.
you need to zip the project
Hi
The WindowsFormsApllication and WebFormsApplication appears not to have a GetModelFilePath() so I cannot call this,GetModelFilePath()
In the WinApplication.cs I have added this code
protected override string GetModelAssemblyFilePath()
{
return this.GetModelFilePath();
}
but that does not compile because this.GetModelFilePath does not exist.
I have zip'ed the project but when I drag it to the editor it doesn't seem to get attached but I can send it in an email if you provide an address or I can put it on an FTP server.
Reference the Xpand.ExpressApp.ModelDifference assembly in your front end project, or the nuget package
this.GetModelFilePath();
having the reference you can use the above extension which can be found at
https://github.com/eXpandFramework/eXpand/blob/9bd90234886b9ff6f47ba5cdced6cd59bebb3be7/Xpand/Xpand.ExpressApp.Modules/ModelDifference/Core/Extensions.cs#L8-L11
or if u preference u can use it as
Xpand.ExpressApp.ModelDifference.Core.GetModelFilePath(this);
follow the instruction to the letteter please it cannot compile cause u do not have the ModelDifference refernce/dependency
Hi
I have got it to compile, but it does not fix the problem.
I now have the following code in WinApplication.cs
public static string GetModelFilePath(XafApplication application, string filePath = null)
{
var path = Path.Combine(Path.GetTempPath(), $"{application.GetType().Name}ModelAssembly.dll");
return application.GetPlatform() == Platform.Win ? filePath ?? path : application.GetFieldValue("sharedModelManager") == null ? path : null;
}
and it compiles,
However the code is not called at any time specifically not when I doubleclick one of the ModelDifference objects.
I suspect that is because it is not an override as mentioned in the original error message, but GetModelFilePath does not exist to be overridden in WinApplication.
If you want to have a look, I have uploaded the zipped project to my ftp server at ftp.nemedi.dk, user expand, no password.
i can feel your pain however my time is limited and is clear that your coding experience is rather low. Once more I encourage you to follow the message which says
override the superEDI2.Win.superEDI2WindowsFormsApplication GetModelAssemblyFilePath
so override it and since you already copy-paste the GetModelFilePath as i understand instead of using the original by adding a dependecy as u were instructed by the message you can write the following
protected override string GetDcAssemblyFilePath() {
return GetModelFilePath(this);
}
public static string GetModelFilePath(XafApplication application, string filePath = null) {
var path = Path.Combine(Path.GetTempPath(), $"{application.GetType().Name}ModelAssembly.dll");
return application.GetPlatform() == Platform.Win ? filePath ?? path : application.GetFieldValue("sharedModelManager") == null ? path : null;
}
Closing issue for age. Feel free to reopen it at any time.
.Thank you for your contribution.