12 thoughts on “About

  1. 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.


    • 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.


  2. 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.


  3. @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.




    function (kendo) {
    var loginViewModel = new kendo.data.ObservableObject({
    username: ‘input username…’,
    password: ”,
    validator: {},
    notification: {},
    onClick: function () {
    if (this.validator.validate())
    this.notification.show({ message: ‘Please insert username and password fields’ });
    return loginViewModel;


    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’);

           var validator = $('#login-form').kendoValidator().data('kendoValidator');
           kendo.bind($('#login-form'), viewModel);
           viewModel.set('notification', notification); // -> raise error: parent() undefined
           viewModel.set('validator ', validator ); // -> raise error: parent() undefined


    Thank you for any ideas


    • Hi Alexander, if needed, you can click on my Codementor badge on the right column of this blog, I can review your implementation.


Please Leave a Reply or Tweet me @LeLong37...!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s