Need some samples

Aug 23, 2011 at 7:22 AM

Hi

Was looking around for generic repository pattern and unit of work pattern with the entity framework and stumpled upon this nuget package.

Have been pooking around and looking at the source code and its unit tests, but I think that some simple samples for using the code would make this promising pack even more interesting.

Any timeline on the documentation? And would you say the package is production ready?

Coordinator
Oct 3, 2011 at 9:49 PM

Hi,

sorry for the long delay. I forgot to subscribe to all discussion so i haven't been notified of this question.

I've been quite busy in the past few month; that's why the the documentation is desperately empty; i'm really sorry for that.

Adding samples is definitively in my to do list in the top position.

If you're still interested in some sample code, you might want to have a look to this post on my blog. It's in French but there is enough code to understand.

Hope this helps.

Coordinator
Oct 10, 2011 at 2:15 PM
Edited Oct 10, 2011 at 2:16 PM

I've just added a tutorial that shows how to use Repository<T> and UnitOfWork patterns

May 28, 2012 at 3:14 PM

Can you explain this a little better?  How do you mock the repository?  In your code the DbContext is passed in, or you create it.  That is not testable.

Coordinator
May 30, 2012 at 8:45 PM
Edited May 31, 2012 at 7:43 AM

cbordeman,

did you read the tutorial ?


cbordeman wrote:

In your code the DbContext is passed in, or you create it.

here is what you can read in the tutorial :

In order to manipulate products, we can create a Repository like this :

using(Context ctx = new Context())
{
    DbContextAdapter adapter = new DbContextAdapter(ctx);
    IRepository<Product> productRepo = new Repository<Product>(adp);
}

=> I create the context and it is passed to the Reposotory via the DbContextAdapter.

cbordeman wrote:

How do you mock the repository?

I use moq when i want to mock something. You might want to have a look at the tests project that is shipped with Efpatterns.


cbordeman wrote:

Can you explain this a little better.

What exactly is not understandable? I am ready to improve, but I need to know what...


cbordeman wrote:

That is not testable.

What makes you think repositories are not testable? once again please browse the tests project.

 

As a side note try to be a little more moderate in your words especially when you ask for help.

Anyway, i hope this will help you; and that you'll enjoy using EFPatterns.

Jun 1, 2012 at 7:47 PM

Thanks Fab for the reply.  I did not download the full source before.  I really like this package and I want to use it moving forward.  It is the most robust implementation of these patterns I've seen.  Good work!

Looking at your tests, you're not mocking the derived DbContext (Context).  Instead, you're simply creating an instance of Context, pointing it to a (localdb) server.  It appears that, to use EF.Patterns, DbContextAdapter is always neccessary, and its constructor can only take a real DbContext instance.

So the design seems to have a hard dependency to EF that can't be removed.  Is this correct?  I don't think it's a deal breaker; the use of (localdb) is pretty neat.

If you want to improve something, add a sample explaining how to test.

Again, fantastic work.

Does this work with EF5 pre-release?

Coordinator
Jun 2, 2012 at 9:30 PM

Thank you for the compliments cbordeman.

You're totally right this project aims to implements some patterns and use them with Entity Framework, and only with it. So yes there is a strong dependency to EF.

Speaking of EF5 pre-release, i have to be honest, lately i'm spending all my free time on another pet project, thus i've not tried to port/test EFPatterns with this version of Entity Framework.

Jun 3, 2012 at 3:07 AM
That’s the name of the project after all. ;)
Did you see the discussion I opened asking about how to Include a member on the query methods like GetAll() that is TWO levels deep?
So far in my limited testing just with the default repository, I’m not seeing any problems with EF5.
I’d really like to see a bit of documentation on the usage of the other repository types.
Thanks again Fab!
From: [email removed]
Sent: Saturday, June 02, 2012 4:30 PM
To: [email removed]
Subject: Re: Need some samples [EFPatterns:270042]

From: Fab_Michellonet

Thank you for the compliments cbordeman.

You're totally right this project aims to implements some patterns and use them with Entity Framework, and only with it. So yes there is a strong dependency to EF.

Speaking of EF5 pre-release, i have to be honest, lately i'm spending all my free time on another pet project, thus i've not tried to port/test EFPatterns with this version of Entity Framework.

Coordinator
Jun 3, 2012 at 9:32 PM

Yes, I've wrote a first quick answer on the other thread.

Glad to hear that you've tried EFPatterns with EF 5 and that it seems to work.

Concerning the docs, for sure this an area of the project that need to be improved.