Converting VS 2005 Web Site Project to VS 2005 Web Application Project

Discussion in 'ASP .Net' started by ITistic, Aug 20, 2007.

  1. ITistic

    ITistic Guest

    I've recently attempted converting a small VS 2005 ASP.NET Web Site
    Project to a Web Application Project using Scott's blog post:

    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
    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)


    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.

    ITistic, Aug 20, 2007
    1. Advertisements

  2. ITistic

    Guest Guest

    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
    Guest, Aug 20, 2007
    1. Advertisements

  3. ITistic

    ITistic Guest

    I actually was planning on moving forward exactly as you described.
    Seeing this would not work after conversion I then created a separate
    Class Library project entitled "DAL" and copied these classes into
    that project. I then removed the "Namespace" statements from each
    class, and added the DAL project as a reference in my WAP. My thought
    was that I'd then be able to access the classes just as before by
    using "DAL.MethodName", but this TOO does not work. If I create a
    brand new class in the DAL library I can access it just fine. These
    classes that I am copying over exhibit the same problems as they did
    as part of the WAP. This must be some sort of bug.
    ITistic, Aug 21, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.