TFS build warning during database project build

Running builds containing Visual Studio Database Projects may lead to build warnings like

(1784): An error occurred when opening a file “.dbschema”: Assembly “.dbschema” is not a valid .NET assembly and will be skipped for analysis.

This warning is issued by the test impact analysis during build that can be disabled by specifying

<PropertyGroup> . . . → Read More: TFS build warning during database project build

Specification pattern using expressions and repositories

Following you can find an example of implementing the specification pattern.

The full implementation you can find in NQueries.

Sample Specifications

public class ProductNameContainsSpecification : Specification<Product> { public ProductNameContainsSpecification() : base(x => x.Name.Contains(“Road”)) {} } public class ProductByIdSpecification : Specification<Product> { public ProductByIdSpecification() : base(x => x.ProductID == 680) {} }

Usage

using (IUnitOfWork . . . → Read More: Specification pattern using expressions and repositories

First Beta of NQueries released

NQueries is a Transactional data access layer using UnitOfWork and Repository patterns against IQueriables. Key features: loose coupled from the Entity Framework, query against an interface, not against the ObjectSet. generic repositories generates plain pocos dependent transactions spanning multiple threads multiple nested unit of works sharing one transaction precompiled queries easy transaction/datacontext management almost . . . → Read More: First Beta of NQueries released

Creating generic display and edit templates for ASP MVC

Inspired from Brad Wilson great series about MVC2 templates I had a deeper look into this topic.

I noticed 2 things:

There is no DisplayTemplate for tables. There’s still need to manually create typed views for display, edit and create for each domain object you want to edit.

After some testing around I’ve finally . . . → Read More: Creating generic display and edit templates for ASP MVC

How to optimize your MTU

Ping some site, setting the “don’t fragment” flag and specify the mtu like here:

ping www.somesite.com -f -l 1500

You should get:

Packet needs to be fragmented but DF set.

If not, raise the mtu in the ping until you do. Now find the highest mtu value without the above error, add 28: thats . . . → Read More: How to optimize your MTU

Strongly typed include in the entity framework

I’m still trying to avoid using magic strings with the entity framework. Don’t know why there’s still so many of them, hope this will change in the future. Here I just want to show you the way I implemented a strongly typed variant of the Include statement.

With the following extension your are able . . . → Read More: Strongly typed include in the entity framework

Precompiled linq statements

Update: The example has a bug, there is little use of using Compile, without using EFs CompiledQuery. It’s a bit rough to get this working with a repository pattern that actually hides the entity framework like in the example. I’ll update this post as soon as I have time to solve this.

Update2: Meanwhile . . . → Read More: Precompiled linq statements

ASP.NET MVC 2 Templates

Usually I don’t post anything, other people have already written about or I don’t have anything new to say about.

But here I will make an exception, Brad Wilson really made my day with his great post about ASP.NET MVC 2 Templates.

NQueries

Started to work on a transactional data access layer using unit of work and repository patterns against IQueriables. Of course, this is based on Entity Framework, but the goal is to get rid of reference to System.Data.Entity and still beeing able to query data from the repositories using IQueryables only.

The earlier try I . . . → Read More: NQueries

Using localized resources in javascript files for a asp mvc project

I’ve been spending a lot of time searching for a common way to get my localization strings out of my resource files into javascript.

I found a couple of roads to follow, but didn’t really like any of them.

Manually create a javascript file containing the resources

Ehh, what? Dublicating my resources? No way.

. . . → Read More: Using localized resources in javascript files for a asp mvc project