-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please introduce RepositoryFactory Pattern in UnitOfWork Implementations #146
Comments
@noufionline Thanks for the suggestion. Can you provide a sample implementation? Feel free to fork the repo, create a branch, and submit a pull request. Sounds like a good idea. |
Sure!
and this interface must be injected in your Unit Of Work class
The implementation of this interface should be left to users who might prefer to create the repository using reflection or a prefred container, or may be a default implementation can be provided with a concrete base class which can be overriden by the user. in my case I prefer to use my container to resolve the requested repository. By doing this only the required repository will be created and can avoid unncessery creation of all the repositories even when only one or two is used. If you can do this in your T4 Template then all the repository can be created using this factory. |
@noufionline Thanks, I'll have a look at putting the interface into the Patterns lib. Not sure if I currently have the bandwidth to update the UoW template, but I can look into that. I noticed you opened a PR #148 -- is there a reason why you closed it? |
I am creating a pull request for the first time and was confused a lil bit. Now I have two pull requests don't know how to delete my own code. But it's a good beginning anyways :) |
What you want to do is to a) fork the TE repo, b) create a local branch, c) commit your changes to the local branch you created, d) publish your branch, e) create a new pull request. Hope that helps. |
Thanks a lot for your tips. :) It really helped. |
Created a pull request #149 to address this issue. |
Hi Tony,
First of all, Kudos for your excellent contribution to the community.
Wouldn't it be nice if we introduce RepositoryFactory Pattern and Inject only that in the UnitOfWork Constructor.
So instead of this
Something like this
in this way we can avoid injecting all the repositories from the constructor.
The text was updated successfully, but these errors were encountered: