RepositoryGenerator icon indicating copy to clipboard operation
RepositoryGenerator copied to clipboard

[Question] How to use UnitOfWork?

Open mahdi87gh opened this issue 8 years ago • 0 comments

Hi, Thanks for your great work here. I have a question to ask. Here is my test project hierarchy : -Solution --Test.DomainModel -- Test.Repo --Test.Api

In DomainModel class library just there are my entity models. In Repo class library I added your nuget package and generated Repositories and unit of work. In Api winApp I tried something like this code just for testing:

using (var db = new UnitOfWork())
            {
               var item = db.Barbers.GetById(textBox1.Text);
               MessageBox.Show(item.BarberName);
            }

It fails to run, Needs for a connection string in my Api project! Which is already defined in Repo and DomainModel projects. When I copy the connection string from these projects to Api project app.config file, I get error for Needing entityframework and system.data.sqlClient dlls . Why is like this. When I'm using a repository, shouldn't it handle these things?! I wish not to include entityFramework to my Api project. By the way could you upload a sample project ?

mahdi87gh avatar Apr 12 '16 05:04 mahdi87gh