WPF Subsonic status update

I don’t know how many of you are interested or follow up on this effort. For those of you that do, I’m happy to say that the first release is very close.


The issue I still have to solve before publishing my code is the configuration one. Subsonic uses Web.Config to specify Database connection strings and the .Net 2.0 provider model to specify the Database drivers to be used. All these are configured in a custom configuration section that is read with a WebConfigurationSection descendant class at built time.


Since though custom build providers are not available at the Windows Forms platform I had to use another technique to emit the generated code in my programs. For this I decided to use Visual Studio Custom Tools following Dino Esposito’s article on MSDN Magazine. The problem with this implementation is that since your BaseCodeGeneratorWithSite class is registered as a COM object and created in Visual Studio’s scope, it has no longer access to types that could resolve the Custom App.Config Section (doesn’t know where to find the assemblies).


I’m thinking on putting the configuration section on the custom file that is passed on the BaseCodeGeneratorWithSite class as a parameter in the GenerateCode(string inputFileName, string inputFileContent) method. What do you think?

 
Comments

I”ve been following your posts on this port with much anticipation. I love subsonic and have one real-world implementation going up on the web this week for a customer. I”d love to be able to bring the simplicity of subsonic to the Windows Forms environment.

I think passing in strings of XML-based config is a good option. At least this permits the developer to decide how and where it is stored and retrieved.

Looking forward to your first release.

Hi, I hit your blog today. I may just have done something that will simplify your life 🙂

Take a look at http://www.devinstinct.com/Eng/code.htm

…SubSonic for EXEs and DLLs, in a Custom Tool.

Also, take a look at the CompileUnitGeneratorHost and ConfigurationProvider classes, you”ll like the hack for the configuration files issue and the way I bypass the singleton architecture of SubSonic to use it in a Custom Tool (multiple projects and configurations).

Thanks Martin for helping out on my Subsonic quest.

I was thinking of doing something similar but didn’t have time, so I’m glad you came along and indeed “simplified my life” ;-).

Leave a Reply