Hello DX,
I've been following this article for guidance on how to update the XPOjectType.AssemblyName
column from a module updater . While trying various approaches to get the current assembly name and avoid assembly name parsing, I noticed that the XPClassInfo.AssemblyName
always seems up-to-date. I'm assuming that property is assigned from the currently loaded assembly so it should always be the current version? If that is the case, what do you think of the following approach:
C#public sealed class MyModuleUpdater : ModuleUpdater
{
public MyModuleUpdater(IObjectSpace objectSpace, Version currentDBVersion) : base(objectSpace, currentDBVersion)
{
}
public override void UpdateDatabaseBeforeUpdateSchema()
{
base.UpdateDatabaseBeforeUpdateSchema();
Session session = ((XPObjectSpace)ObjectSpace).Session;
foreach (XPObjectType objectType in session.TypesManager.AllTypes.Values)
{
if (objectType.TypeName.StartsWith("DevExpress", StringComparison.OrdinalIgnoreCase))
{
XPClassInfo classInfo = objectType.GetClassInfo();
if (!string.Equals(objectType.AssemblyName, classInfo.AssemblyName, StringComparison.OrdinalIgnoreCase))
{
UpdateXPObjectType(objectType.TypeName, objectType.TypeName, classInfo.AssemblyName);
}
}
}
}
}
Thanks,
Alex