Skip to content

[Question] How to use UnitOfWork? #3

Description

@mahdi87gh

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 ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions