ASP.NET MVC using an N-Tier Model and DDD Any comments are welcome. However I'd like to call specific attention to my... interpretation of the N-Tier application architecture and how I'm consuming data. Note that the namespacing and inline comments have been factored out for brevity.

The Data Tier (DataModel.csproj)

// Base class for EF4 Entities
public abstract class EntityBase {
    public int Id { get; set; }
}

// Entities
public class Account : EntityBase {
    public string UserName { get; set; }
    public string Password { get; set; }
    public byte[] Salt { get; set; }
    public string EmailAddress { get; set; }
}

public class Entry : EntityBase {
    public string Title { get; set; }
    public DateTime Created { get; set; }
    public Account Owner { get; set; }
}

// EF4 Code-First Data Context
public class DataContext : DbContext {
    public DbSet&lt;Account&gt; Accounts { get; set; }
    public DbSet&lt;Entry&gt; Entries { get; set; }
}

// Repository Pattern
public interface IRepository&lt;TEntity&gt;
    where TEntity : EntityBase {
    TEntity Create();
    void Delete(TEntity entity);
    TEntity Get(int id);
    TEntity Get(Expression&lt;TEntity,bool&gt;&gt; where);
    void Insert(TEntity entity);
    void Save();
    IQueryable&lt;TEntity&gt; Where(Expression&lt;TEntity,bool&gt;&gt; where);
}

public class Repository&lt;T&gt; : IRepository&lt;T&gt;
    where T : EntityBase, new() {
    private readonly DataContext context;
    private readonly DbSet&lt;T&gt; set;

    public Repostory(DataContext context) {
        // context injected via ioc.
        this.context = context;
        this.set = this.context.Set&lt;T&gt;();
    }

    // Implementation of IRepository&lt;T&gt;
}


Business Logic Tier (Runtime.csproj)

// IOC Container
public static class IOC {
    public static readonly IWindsorContainer Container = new WindsorContainer();

    static IOC() {
        InstallAssembly("Presentation");
        InstallAssembly("Runtime");
        InstallAssembly("DataModel");
    }

    public static void InstallAssembly(string name) {
        Container.Install(FromAssembly.Named(name));
    }
}

// Also includes System.Configuration ConfigSections, HttpModules and Provider classes
// which are strongly tied to IRepository&lt;&gt;.


Presentation Layer (Mvc App) (Presentation.csproj)

protected void Application_Start() {
    AreaRegistration.RegisterAllAreas();
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    // Controller Factory instance makes initial reference to IOC class, causing
    // the installers to run.
    ControllerBuilder.Current.SetControllerFactory(new Runtime.Mvc.WindsorControllerFactory());
}

// Data-Driven Controller
public class DashboardController : SecureController {
    private readonly IRepository&lt;Entry&gt; entries;

    public DashboardController(IRepository&lt;Entry&gt; entries) {
        // entries injected via ioc.
        this.entries = entries;
    }

    [ChildActionOnly, HttpGet]
    public ActionResult RecentEntries() {
        var viewModel = new RecentEntriesViewModel( entries.Where( stuffHappens ) );
        return PartialView(viewModel);
    }
}


I feel like letting IRepository&lt;> reach the presentation layer may be a violation of the pattern. Exposition of an IQueryable&lt;> through IRepository&lt;>.Where seems like a bad idea at the Presentation level. There's no way to moderate the use of IQueryable and could lead to brittle code. Inputs?
I agree that exposing IRepository&lt;> to the presentation layer is bad.

The reason it's bad is that your Business Logic Tier (BLT) might want to enforce business-y rules on the access of data. That's what the business layer is for, after all.

Your heart is in the right place when you restrict use of the repository to .Where in the presentation layer. However, you still have that entries field exposed for another programmer to come along and abuse later. To prevent this from happening, you could expose only an Expression in the presentation layer. Pass that Expression to the BLT, which would then instantiate the IRepository&lt;> and use the Expression. That would also provide a hook for the BLT to add additional conditions to the Expression for access control, etc.