0

I have a BLL and DAL projects in my solution in addition to my web application project. I'm using entity framework 5 and i had the .tt file within the DAL project. Everything was working fine but then i tried separating the .tt file into a new project "Entities" based on this link.

The Entities and DAL projects build fine. But for all the classes in my BLL that has "using DAL", I have a new error "The type or namespace DAL cannot be found". I tried cleaning all solutions and rebuilding them in order, I also tried removing the DAL reference from the BLL project and readding it but still the same error.

What could be causing this problem? What more information i can add to help finding out what the issue is ?

enter image description here

EDIT:

Here's an example of a generated POCO class

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Entities
{
    using System;
    using System.Collections.Generic;

    public partial class tblsource_type
    {
        public tblsource_type()
        {
            this.tbltitles = new HashSet<tbltitle>();
        }

        public int Source_Type_Id { get; set; }
        public string Source_Type_Name { get; set; }

        public virtual ICollection<tbltitle> tbltitles { get; set; }
    }
}
user3340627
  • 3,023
  • 6
  • 35
  • 80
  • have you checked the build order and dependencies? Are the classes generated and become part of the DAL project? – Jaster Nov 16 '15 at 12:56
  • 2
    Can you show us how a class of your DAL dll looks like? Including the namespace – Juan Nov 16 '15 at 12:56
  • Did you make sure that the new project use the same .NET version ? – Emmanuel M. Nov 16 '15 at 13:05
  • @Jaster yes I made sure I build them in the correct order. The POCO classes are generated fine and I referenced the new tt file from within the DAL edms – user3340627 Nov 16 '15 at 13:42
  • @Juan Please check my updated question. I don't have any cs files in my DAL. – user3340627 Nov 16 '15 at 13:46
  • @EmmanuelM. Yes they are all targeting 4.5 version – user3340627 Nov 16 '15 at 13:47
  • 1
    So do you need the `using DAL;` code? Do your TT generate POCO classes under that namespace? Can we see the generated classes code? – Juan Nov 16 '15 at 14:12
  • @Juan thank you for your help. I was trying to let the old code (using DAL) to work, although I no longer need it. I removed the reference and it's working fine now. I appreciate your time. – user3340627 Nov 16 '15 at 14:27
  • Ok, I have added an answer for this. Glad it worked – Juan Nov 16 '15 at 14:39

1 Answers1

1

Looks like you no longer need the using DAL; statement as you don't have anything any more on that namespace. Just remove it and should be fine.

Juan
  • 3,675
  • 20
  • 34