|
|
|
start date: Mon, 20 Aug 2007 17:23:33 -0000,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
ITistic
|
|
2
Peter Bromberg [C# MVP]
|
Converting VS 2005 Web Site Project to VS 2005 Web Application Project
I've recently attempted converting a small VS 2005 ASP.NET Web Site
Project to a Web Application Project using Scott's blog post:
http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx
This seems to be the best documentation available currently. After
following all of the steps I've run into 1 problem. In the original
Web Site project there were a few classes which were part of their own
namespaces. Here's an example of one of these classes:
Namespace DAL
Public Class Delinquents
Public Shared Function GetByID(ByVal ID As Integer) As
BOL.Delinquent
Dim db As Database = DatabaseFactory.CreateDatabase("dbNoPropane"),
_
SelectCmd As DbCommand =
db.GetStoredProcCommand("usp_SelectDelinquentByID"), _
dr As IDataReader, _
MyD As New BOL.Delinquent
db.AddInParameter(SelectCmd, "delinquent_id", DbType.Int32, ID)
dr = db.ExecuteReader(SelectCmd)
If dr.Read Then PopulateDelinquent(dr, MyD)
SelectCmd.Dispose()
Return MyD
End Function
End Class
End Namespce
In my code we'd call these methods as follows:
MyD = DAL.Delinquents.GetByID(Value)
All of this works fine in the Web Site project. After converting to
the Web Application project per Scott's instructions none of these
namespaces seem to be recognized by my code. The files are all still
there, namespaces defined in them properly, etc. If I create a new
class and put it in one of these namespaces my code recognizes IT
fine, but it won't recognize the existing classes even though they are
semantically the same. Anyone have any idea why this is and how I can
fix this?
Your response and time is greatly appreciated.
Thanks!
Date:Mon, 20 Aug 2007 17:23:33 -0000
Author:
|
RE: Converting VS 2005 Web Site Project to VS 2005 Web Application Pro
Typically what you would do here is take your DAL "Stuff" and compile it into
a separate class library project, and have a reference to this project in
your WAP application, along with the apppropriate using .. or Imports. ..
statement. That's the whole idea of OOP and code - reusability.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"ITistic" wrote:
> I've recently attempted converting a small VS 2005 ASP.NET Web Site
> Project to a Web Application Project using Scott's blog post:
>
> http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx
>
> This seems to be the best documentation available currently. After
> following all of the steps I've run into 1 problem. In the original
> Web Site project there were a few classes which were part of their own
> namespaces. Here's an example of one of these classes:
>
> Namespace DAL
> Public Class Delinquents
> Public Shared Function GetByID(ByVal ID As Integer) As
> BOL.Delinquent
> Dim db As Database = DatabaseFactory.CreateDatabase("dbNoPropane"),
> _
> SelectCmd As DbCommand =
> db.GetStoredProcCommand("usp_SelectDelinquentByID"), _
> dr As IDataReader, _
> MyD As New BOL.Delinquent
>
> db.AddInParameter(SelectCmd, "delinquent_id", DbType.Int32, ID)
>
> dr = db.ExecuteReader(SelectCmd)
>
> If dr.Read Then PopulateDelinquent(dr, MyD)
>
> SelectCmd.Dispose()
>
> Return MyD
> End Function
> End Class
> End Namespce
>
> In my code we'd call these methods as follows:
>
> MyD = DAL.Delinquents.GetByID(Value)
>
> All of this works fine in the Web Site project. After converting to
> the Web Application project per Scott's instructions none of these
> namespaces seem to be recognized by my code. The files are all still
> there, namespaces defined in them properly, etc. If I create a new
> class and put it in one of these namespaces my code recognizes IT
> fine, but it won't recognize the existing classes even though they are
> semantically the same. Anyone have any idea why this is and how I can
> fix this?
>
> Your response and time is greatly appreciated.
>
> Thanks!
>
>
Date:Mon, 20 Aug 2007 12:58:07 -0700
Author:
|
|
|