C# – SubSonic – Class Library Project

cclasshttpcontextsubsonic

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!

Best Answer

("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.