
@LeLong37 @ Microsoft Build 2013
Long Le
Principle .NET App/Dev Architect & TFS ALM Practitioner @ CBRE
MCPD, MCSE + I, Twilio Cloud Communication Authorized .NET Systems Integrator
Telerik/Kendo UI MVP
Blog: http://blog.LongLe.net
Twitter: http://twitter.com/LeLong37 (best way to reach me)
LinkedIn: http://www.linkedin.com/in/LeLong37
Happy Coding…! 🙂
HI Le, I am labouring a little here, in your dowloadable generic unit of work and repository pattern code. I could use a pointer or two:
a) with the separation of concerns: If I want it to work, each layer of the system seems to require project references to Repository.Pattern.EF6 AND Repository.Pattern. Instinctively this cannot be right. If I leave it out it the UI layer for example, it complains of “no natural cast between TEntity and IObjectState”. Have I missed a project reference lower down the stack that could be causing this?
b) you carefully describe a Data project in your online article, yet the downloadable code seems to have the Entities and Data projects merged. Couldn’t see documentation as to why they are joined then back up. Could you explain?
c) I am used to using SQL Server Designer, then creating EF code from the database, using the EDMX and inbuilt tools Code first is a luxury of greenfield projects I don’t get to enjoy much. So, as convenient as it is to roll your own POCOs, the project structure you have should be applied to this DB first scenario too. Trying it, I assume it’s just a question of adapting the created DbContext class, keeping the POCOs and the Mappings as created by TT scaffolding, but are there other things to take care of? The EDMX tools create a particular flavour of code (namespaces, connections, where things are kept etc.) so it’s not always obvious to adapt. I wonder if working with DB first is the answer to (b)!
Within my app, my goal is to have multiple bound texts, each with a single root exposed in the repository, and use lazy loaded navigation properties. So, rather than return all tables relating to a single aggregate in per repository, I think I really only want one repository returning aggregate roots. I’d be interested in your thoughts on that.
Secondly, I am keen to get rid of eager loading, as it is not helpful when you have many GBs of images in the DB. So, an arbitrary choice of IEnumerable so deep down carries issues for me, at least in this application. To optimise, I actually select all columns except the imagedata, but it is still quite slow. And INSERT operations are ludicrously slow using EF6, with SaveChanges() taking near 50% of processing time, and many seconds of time to complete. They are photos typically 1-3Mb in size. It’s far too slow. I am convinced that oversized object graphs are the cause.
Thought provoking article, which has made me think. Thanks for your considered response.
LikeLike
Edit: “Within my app, my goal was originally to have multiple bound contexts, each for a given aggregate. But in use, rather than return all tables relating to a single aggregate in each repository, I think I really only want one repository returning the set of aggregate roots instead. I’d be interested in your thoughts on that.
LikeLike
you are great !
LikeLike
You did a very good video on the following:
Unit of Work & Repository Framework in ASP.NET MVC 5 with Entity Framework 6 & Unity 3 – v2
I went to download the sample at:
Sample application download: https://skydrive.live.com/redir?resid=949A1C97C2A17906%216769
and received the following message:
This item might not exist or is no longer available
Is there a place that I can go to download the sample.
You did such a great job and I would like to be able to see the whole project as one.
LikeLike
Please download from http://genericunitofworkandrepositories.codeplex.com/
LikeLike
Is that the sample application that you did with the Northwinds database in the video?
LikeLike
Yes
LikeLike
I see it now. Thank You!
LikeLike
@LeLong37
Hi Le Long!
I read your msdn magical post http://msdn.microsoft.com/ru-ru/magazine/dn605877.aspx
This is a very cool article!
I need to use kendo notication and validator in the accountViewModel on Login.chtml.
I do not know how pass an notification and validator instances to the viewModel.
Login.chtml:
loginViewModel.js
define([‘kendo’],
function (kendo) {
var loginViewModel = new kendo.data.ObservableObject({
username: ‘input username…’,
password: ”,
validator: {},
notification: {},
onClick: function () {
if (this.validator.validate())
$(‘#login-form’).submit();
else
this.notification.show({ message: ‘Please insert username and password fields’ });
}
});
return loginViewModel;
});
router.js
…
router.route(‘/account/login’,
function() {
require([‘loginViewModel’, ‘text!/account/login’],
function (viewModel, view,
// delegate after binding completed…
function() {
var notification = $(‘#notification’).kendoNotification({
position: { pinned: true, top: 200, right: 100 },
autoHide: 3000).data(‘kendoNotofication’);
});
Thank you for any ideas
LikeLike
Hi Alexander, if needed, you can click on my Codementor badge on the right column of this blog, I can review your implementation.
LikeLike
Greetings! Very useful advice in this particular post!
It is the little changes which will make the most
important changes. Thanks for sharing!
LikeLike
Thanks Manuela for the positive feedback.
LikeLike