Search code examples
c#entity-frameworkassembly-references

Unable to reference DAL project from BLL after separating POCO classes


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; }
    }
}

Solution

  • 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.