NHibernate Query Generator: Status Update
After last night's Proof Of Concept, I started to work on making the generator generate the correct code from the mapping. I commited the code, but I had to disable all the tests to make it works. Basic trial and error show that it works.
It turned out to be quite a bit hard than I hoped it would be. I have some experiance using CodeDOM, but the amount of stuff required just to keep track of what is going on is amazing. Especially since I have a lot of conditions all over the place.
Check out what you need to do in order to generate this:
get {
return new Query_Home<T1>("Home", null);
}
}
Write this:
prop.Name = name;
prop.Type = new CodeTypeReference(innerClass.Name, new CodeTypeReference(genericParameterName));
prop.Attributes = MemberAttributes.Public;
prop.GetStatements.Add(
new CodeMethodReturnStatement(
new CodeObjectCreateExpression(
new CodeTypeReference(innerClass.Name, new CodeTypeReference(genericParameterName)),
new CodePrimitiveExpression(name),
new CodePrimitiveExpression(null))));
parent.Members.Add(prop);
Comments
Comment preview