Referencing my Models in DAL

219 Views Asked by At

Happy New Year everyone. Ok, i'm trying to create a 3 tier application and i have my references in the following order UI -> BLL -> DAL. The question is. The problem i'm having is with the Dbset. Because i have no reference to my models within my DAL, the dbset fails.

namespace MyApp.DAL
{
    public class MyAppDb : DbContext
    {
        public MyAppDb() : base("name=MyAppDBstring")
        { }

        public DbSet<SomeModel> SomeModels { get; set; }
    }
}

How do i get this to work if it cant find my SomeModel class in my BLL? Any help would be greatly appreciated.

1

There are 1 best solutions below

3
On

In this case you would need to add a reference to your BLL project in your DAL project. Right click References>Add Reference and then the Solution tab tick your BLL project.

From this you will then be able to put a using statement on the top of the class above something along the lines of:

using MyApp.BLL;