Hello:
I was trying to use hbm2net to generate the code for some mapping files that have the class name in the form:
namespace.class, assembly
The generated files was having incorrect namespace and was ssaved in an incorrect path, i think the problem could be in the
initFullyQualifiedName method of the
NHibernate.Tool.hbm2net.ClassName class, i think it should look like this:
Code:
private void initFullyQualifiedName(string fqn)
{
this.fullyQualifiedName = fqn;
if (fullyQualifiedName.IndexOf(",") > 0)
{
fullyQualifiedName = fullyQualifiedName.Substring(0, fullyQualifiedName.IndexOf(","));
}
if (!Primitive)
{
if ((Object) fullyQualifiedName != null)
{
int lastDot = fullyQualifiedName.LastIndexOf(".");
if (lastDot < 0)
{
name = fullyQualifiedName;
packageName = null;
}
else
{
name = fullyQualifiedName.Substring(lastDot + 1);
packageName = fullyQualifiedName.Substring(0, lastDot);
}
}
else
{
name = fullyQualifiedName;
packageName = null;
}
}
else
{
name = fullyQualifiedName;
packageName = null;
}
}
With that the code looks as being generated correctly, but, please let me know if it's correct or not :)
( Note: i'm building using .net 2.0 )