Question

In the SubSonic docs it lists:

o By default, the Tool generates insert and update code that uses System.Web.HttpContext.Current.User.Identity.Name and System.Threading.Thread.CurrentPrincipal.Identity.Name. Some generated methods may also make use of System.Web classes. If you don’t want to have to add a reference to System.Web in your project, you will have to provide your own templates.

I tried to creat a SubSonic DAL of type C# Class Library. Of course, the files generate, however an error is thrown during build time:

*The type or namespace name 'HttpContext' does not exist ...*

("Is there a separate template available for creating a generic class library DAL that does not include System.Web references?" ? Where : How to modify the existing templates)

Thanks!

Was it helpful?

Solution

("Is there a separate template available for creating a generic class library DAL that does not include System.Web references?" ? Where : How to modify the existing templates

You need to have a reference to System.Web for SubSonic version 2 or 3 to work. You can just add that to your library project and it'll work.

OTHER TIPS

Wow, talk about over-complicating things. I just added a ref to System.Web - got it. For some reason, I thought I'd have to change the .aspx template.

Oops, and thanks.

Version 2 has a subdirectory with .aspx files that you can modify to change the template code (you just need to change the path in your app.config file to point to new dir of aspx files).

Version 3 has .tt files that you modify.

Information for how to modify both versions of the templates are on the SubSonic project site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top