I have created a module and the assembly type is read successfully during the startup of the application.
When I go to enable the application I get the error (The following code executes):
//set activation status
mt.AutoActivate = true;
"No row with the given identifier exists: -1, of class: Cuyahoga.Core.Domain.ModuleType"
Any tips on this core code error?
The moduletype is being updated, but for some reason, it has the wrong primary key value (-1). Could you debug the code to see if the moduletype object is properly loaded from the database?
I have debugged and the moduletypeid at the time of the loading of the module is -1
At the time when it is read from the database it is supposed to be set to 28 with this command:
if (moduleType.Name != null) chkBox.InputAttributes.Add("moduleTypeId", moduleType.ModuleTypeId.ToString());
moduleType.ModuleTypeId.ToString() = "28"
The exception is thrown with this error when activating:
Could this error be related with the NHibernate component?
mt.Name threw an exception of type 'NHibernate.ObjectNotFoundException'
void {NHibernate.ObjectNotFoundException}
I think I found the problem. It is identifying my module as new and adding the default -1 value in moduletypeid.
The module exists in the database, so I do not understand the reason.
Can I send you the module to check why?
This is the code that sets the value to -1
if (shouldAdd)
{
ModuleType newModuleType = new ModuleType();
newModuleType.Name = di.Name;
availableModules.Add(newModuleType);
}
The module is now working. The problem was that I was using different name in the class declaration
There is one more thing though - very weird. The module appears 2 times.
1 time with a class name, and 1 time with no class name.
Since it is properly installed and working I don't really care about this, but it would be nice to correct it